We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When invoke ConnectVerfication() func in runner it creates new limiter on line 717
naabu/v2/pkg/runner/runner.go
Lines 714 to 717 in 10f5605
Creating new instances of Limiter starts new goroutine: https://github.com/projectdiscovery/ratelimit/blob/77dad731f2e9a2e98564787086ade7be2ac33b4e/ratelimit.go#L112-L129
And it closed only if any of two contexts done https://github.com/projectdiscovery/ratelimit/blob/main/ratelimit.go#L39-L45
select { case <-ctx.Done(): // Internal Context imiter.ticker.Stop() eturn case <-limiter.ctx.Done(): limiter.ticker.Stop() return case ...
So this happens if original context done or if we call stop method https://github.com/projectdiscovery/ratelimit/blob/77dad731f2e9a2e98564787086ade7be2ac33b4e/ratelimit.go#L101-L106 that cancel second, created context https://github.com/projectdiscovery/ratelimit/blob/77dad731f2e9a2e98564787086ade7be2ac33b4e/ratelimit.go#L113
As we can see, when we invoke ConnectVerification() it creates new instance of limiter with context.Background() and not invoke Stop() later:
Lines 717 to 733 in 10f5605
So, we leak goroutine every ConnectVerification() call, what sometimes creates problems if we work with naabu in SDK mode
Thanks
The text was updated successfully, but these errors were encountered:
I can send a pr if it is convenient for you. It looks like it is safe to call limiter.Stop() after waiting for the swg
Sorry, something went wrong.
No branches or pull requests
When invoke ConnectVerfication() func in runner it creates new limiter on line 717
naabu/v2/pkg/runner/runner.go
Lines 714 to 717 in 10f5605
Creating new instances of Limiter starts new goroutine:
https://github.com/projectdiscovery/ratelimit/blob/77dad731f2e9a2e98564787086ade7be2ac33b4e/ratelimit.go#L112-L129
And it closed only if any of two contexts done https://github.com/projectdiscovery/ratelimit/blob/main/ratelimit.go#L39-L45
So this happens if original context done or if we call stop method https://github.com/projectdiscovery/ratelimit/blob/77dad731f2e9a2e98564787086ade7be2ac33b4e/ratelimit.go#L101-L106 that cancel second, created context https://github.com/projectdiscovery/ratelimit/blob/77dad731f2e9a2e98564787086ade7be2ac33b4e/ratelimit.go#L113
As we can see, when we invoke ConnectVerification() it creates new instance of limiter with context.Background() and not invoke Stop() later:
naabu/v2/pkg/runner/runner.go
Lines 717 to 733 in 10f5605
So, we leak goroutine every ConnectVerification() call, what sometimes creates problems if we work with naabu in SDK mode
Thanks
The text was updated successfully, but these errors were encountered: