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

threadsafe nuclei engine memory leak when Close then New again #5209

Open
iuliu8899 opened this issue May 22, 2024 · 0 comments
Open

threadsafe nuclei engine memory leak when Close then New again #5209

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

Comments

@iuliu8899
Copy link

Nuclei version:

v3.2.7

Current Behavior:

Expected Behavior:

Steps To Reproduce:

func main() {
    for {
	en, _ := nuclei.NewThreadSafeNucleiEngine()
	en.GlobalResultCallback(func(event *output.ResultEvent) {
		fmt.Println(event.Matched, event.Host)
	})
	_ = en.ExecuteNucleiWithOpts([]string{"http://xxxx:port"}, nuclei.WithTemplateFilters(nuclei.TemplateFilters{ExcludeSeverities: severity.Info.String()}))
	en.Close()
    }
}

first round:
image

second round:
image

third round:

Showing nodes accounting for 419.27MB, 69.01% of 607.58MB total
Dropped 289 nodes (cum <= 3.04MB)
Showing top 10 nodes out of 179
      flat  flat%   sum%        cum   cum%
  104.54MB 17.21% 17.21%   104.54MB 17.21%  reflect.New
   68.30MB 11.24% 28.45%    68.30MB 11.24%  gopkg.in/yaml%2ev2.(*parser).scalar
   65.16MB 10.72% 39.17%    65.16MB 10.72%  github.com/projectdiscovery/nuclei/v3/pkg/utils/yaml.PreProcess
   46.84MB  7.71% 46.88%    46.84MB  7.71%  regexp/syntax.(*compiler).inst
   30.02MB  4.94% 51.82%   251.06MB 41.32%  github.com/projectdiscovery/nuclei/v3/pkg/templates.(*Parser).ParseTemplate
   28.02MB  4.61% 56.43%   249.03MB 40.99%  github.com/projectdiscovery/nuclei/v3/pkg/templates.parseTemplate
   26.51MB  4.36% 60.79%    26.51MB  4.36%  reflect.mapassign_faststr0
   19.01MB  3.13% 63.92%    66.02MB 10.87%  github.com/projectdiscovery/nuclei/v3/pkg/protocols/http/httpclientpool.wrappedGet
   17.01MB  2.80% 66.72%    17.01MB  2.80%  github.com/projectdiscovery/retryablehttp-go.DefaultReusePooledTransport
   13.89MB  2.29% 69.01%    13.89MB  2.29%  strings.(*Builder).grow

and so on...

dose the threadsafe engine just not support close() then renew ?

Anything else:

@iuliu8899 iuliu8899 added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label May 22, 2024
@Mzack9999 Mzack9999 self-assigned this Jun 17, 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