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

This could lead to memory leak of Promise/PromiseWrap #35

Closed
strawhatboy opened this issue Jun 8, 2018 · 2 comments
Closed

This could lead to memory leak of Promise/PromiseWrap #35

strawhatboy opened this issue Jun 8, 2018 · 2 comments

Comments

@strawhatboy
Copy link

Hello guys,

I was using this module to track what is pending in my nodejs project, and once my node process ended with heap out of memory, I was confused a lot by checking my code for memory leak...

Finally with ChromeDev tools, I found that the objects Array, Promise & PromiseWrap were always increasing without being released by GC, and they're somehow related to this module.

By checking the source code, async-hook was used to track all the Promises/async/await, and they're put into a map... so I think that's where the leak happens. and after removed require('why-is-node-running') from my code, the memory leak was gone.

So maybe I would like to recommend to put some WARNINGS in the README.md file of this module like:
if you're creating new Promises to wrap traditional callbacks a lot, this module could lead to memory leaks...

Thanks.

@mafintosh
Copy link
Owner

should be fixed by #37

@cardin
Copy link

cardin commented Aug 19, 2020

I think this issue surfaces when using HTTPS agents with keepalive.

I'm writing a site cloner where I'm encountering a scenario with 60,000+ TLSWrap and ZLIB handlers reported. I definitely do not have that many open connections.

For larger sites, I get OOM failure. I tried removing why-is-node-running and the OOM went away.

Could it be related to this issue as well? nodejs/node#33468 I'm running Node 12.8.2.

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

No branches or pull requests

3 participants