Set default threads num instead of zero#1598
Conversation
WalkthroughAdds an exported constant Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A zero value for the number of threads is practically meaningless, because then the sizedwaitgroup will generate 2^32 - 1 goroutines for scans of large subnets, which will consume a huge amount of RAM.
a4481bd to
9ddd3a9
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
pkg/runner/default.go (1)
18-19: DefaultThreadsNum constant fits existing defaults; consider brief rationale commentAdding
DefaultThreadsNum = 25to the shared defaults block is consistent and gives a single source of truth for the default thread count. Behaviorally this is a safe, targeted fix for the zero-threads issue.Optionally, you might add a short comment explaining why
25was chosen (e.g., balance between parallelism and memory usage), to help future tuning.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
pkg/runner/default.go(1 hunks)pkg/runner/options.go(1 hunks)pkg/runner/runner.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- pkg/runner/options.go
- pkg/runner/runner.go
|
@coderabbitai create an issue for this PR related to better handling of default thread number |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain@Mzack9999, I'll create an issue for better handling of the default thread number. 🏁 Script executed: Length of output: 53 @Mzack9999, I've created issue #1599 for better handling of the default thread number. The issue has been assigned to you and includes a reference back to this PR. You can view it here: #1599 |
A zero value for the number of threads is practically meaningless, because then the sizedwaitgroup will generate 2^32 - 1 goroutines for scans of large subnets, which will consume a huge amount of RAM.
It is important to note that the above situation occurs when using the example "Using naabu as a library" from
README.md, because there is just a zero value set due to the fact that it is simply not specified.Summary by CodeRabbit
Refactor
Behavior
✏️ Tip: You can customize this high-level summary in your review settings.