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

goroutines leak when ExecuteNucleiWithOpts with sdk #5191

Closed
iuliu8899 opened this issue May 16, 2024 · 2 comments
Closed

goroutines leak when ExecuteNucleiWithOpts with sdk #5191

iuliu8899 opened this issue May 16, 2024 · 2 comments
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@iuliu8899
Copy link

iuliu8899 commented May 16, 2024

Nuclei version: v3.2.7

Current Behavior:

I use the threadsafe engine in sdk, and called ExecuteNucleiWithOpts func when scan start. Then...
img_v3_02au_c5f55ca3-0997-48c3-90dc-25d06ed39ecg

Stack:

ratelimit.New (ratelimit.go:93) github.com/projectdiscovery/ratelimit
nuclei.createEphemeralObjects (multi.go:54) github.com/projectdiscovery/nuclei/v3/lib
nuclei.(*ThreadSafeNucleiEngine).ExecuteNucleiWithOpts (multi.go:111) github.com/projectdiscovery/nuclei/v3/lib

Everytime ExecuteNucleiWithOpts called, in createEphemeralObjects function, it New a ratelimit object and start go routine at github.com/projectdiscovery/ratelimit(ratelimit.go:93).
image

This go routine only return when context done, but it never called.

There is no Close() function I can use, since the object is only inside that function. (I can't use ThreadSafeNucleiEngine.Close(), it's different ratelimiter.)

Expected Behavior:

Steps To Reproduce:

Anything else:

@iuliu8899 iuliu8899 added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label May 16, 2024
@Mzack9999
Copy link
Member

I'm unable to reproduce in the dev branch .If you check the block code invoking createEphemeralObjects, contextually to the creation and upon nuclei sdk complete execution also closeEphemeralObjects(..) is invoked, which in turn call the stop method of the rate limiter, that cancel the internal context. Would it be possible to provide a PoC to reproduce the behavior you are describing?

@iuliu8899
Copy link
Author

@Mzack9999 ohhhhhh.. Yes, it closed ratelimiter... I was using the old version v3.2.2.....

Really sorry about wasting your time and thanks for your reply.

@iuliu8899 iuliu8899 closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

2 participants