Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add max-os-threads flag #5622

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

add max-os-threads flag #5622

wants to merge 3 commits into from

Conversation

dogancanbakir
Copy link
Member

Proposed changes

Closes #5605

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think if we make this automatic to a reasonable larger amount than the estimated maximum parallelism, for example something like the result of 3 x (concurrency x bulk-size x payload-concurrency + js-concurrency + probe-concurrency)

@dogancanbakir
Copy link
Member Author

We can do that, but I believe overriding it should be an option.

Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is something valid for all the tools I think we should consider overidding the setting via environment variable and move this logic to the utils package that will evaluate within an init() function in any existing package providing similar functionalities, or eventually creating a new one named global, for example:

$ OS_THREADS=xxx nuclei

What do you think?

Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if possible i think we should skip adding this flag, don't exactly have a link to quote at the moment but i did read in golang repo or google form that if max threads threshold is being breached either something went wrong at go level (cgo or something else) or a usecase that might not be suitable for go , but almost all cases this setting would not be required to tweak ( even db's do not start 10k threads if i am not wrong )

also recently a contributor reported same issue when i asked if he was able to repro this on different machine it turned out the bug was in the machine / setup and not nuclei ( see: https://github.com/orgs/projectdiscovery/discussions/4767 )

@dogancanbakir
Copy link
Member Author

@Mzack9999 makes sense.

@tarunKoyalwar We focus only on maximizing limits. If we allow users to configure this, they will have the flexibility to increase the maximum limit and set it to a lower value if desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Fatal error: thread exhaustion
3 participants