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

Reuse uncaughtException handler on Node.js to avoid memory leak. #5698

Closed
wants to merge 1 commit into from

Conversation

loic
Copy link

@loic loic commented Oct 23, 2017

No description provided.

@loic
Copy link
Author

loic commented Oct 23, 2017

When reusing modules multiple time as in #3167 we eventually hit the "Warning: Possible EventEmitter memory leak detected. 11 wakeup listeners added. Use emitter.setMaxListeners() to increase limit" warning because the uncaughtException handler is redefined every time.

@loic
Copy link
Author

loic commented Oct 23, 2017

Closing for now, as it doesn't seem to work, Node.js must do something funky inside process.on() and behaves differently than regular addEventListener().

@loic loic closed this Oct 23, 2017
@loic
Copy link
Author

loic commented Oct 23, 2017

Instead of relying on https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Multiple_identical_event_listeners which doesn't seem to work, I moved the call to process.on() inside the if.

@nazar-pc
Copy link
Contributor

Could you add a test case for this? Because it is not clear under which circumstances it happens.

@kripken
Copy link
Member

kripken commented Nov 7, 2018

This PR is quite old, closing. Feel free to reopen if still relevant.

@kripken kripken closed this Nov 7, 2018
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.

None yet

3 participants