Skip to content

(node:87) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit #3040

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

Closed
siddjain opened this issue Oct 27, 2020 · 6 comments
Labels

Comments

@siddjain
Copy link

  • Node.js Version:

node -v
v12.18.1

  • OS:

uname -a
Linux b8d5107fc64e 3.10.0-1062.9.1.el7.x86_64 #1 SMP Mon Dec 2 08:31:54 EST 2019 x86_64 Linux

(using node:12-alpine Docker image)

I have following code:

process.on('unhandledRejection', (reason, promise) => {
  logger.error(`Unhandled Rejection at: ${promise} reason: ${reason}`);        
});

and it is triggering following warning:

(node:87) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit

The code is not inside any for loop. I am executing it only once. It seems like a bug.

@Lancear
Copy link

Lancear commented Oct 28, 2020

add a log above the process.on('unhandledRejection', ...) and see how often it is logged. those 11 eventlisteners have to come from somewhere

@siddjain
Copy link
Author

siddjain commented Oct 28, 2020 via email

@Lancear
Copy link

Lancear commented Oct 28, 2020

thats weird. is it possible you add that event handler somewhere else? maybe log the event-emitter with console.dir. i believe it shows the registered event handlers.

@preveen-stack
Copy link
Contributor

@siddjain any updates on this issue? Did you get a chance to try with latest nodejs version

Copy link

It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment.
If you need further assistance or have questions, you can also search for similar issues on Stack Overflow.
Make sure to look at the README file for the most updated links.

@github-actions github-actions bot added the stale label May 11, 2024
Copy link

It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment.
If you need further assistance or have questions, you can also search for similar issues on Stack Overflow.
Make sure to look at the README file for the most updated links.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants