help
help copied to clipboard
(node:87) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit
- 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.
add a log above the process.on('unhandledRejection', ...) and see how often it is logged. those 11 eventlisteners have to come from somewhere
That's a good idea. Thanks. I tried it and see log message only once. 2020-10-28T17:36:59.813Z [Main] info: adding unhandledRejection handler (node:8) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit
From: Lance J. [email protected] Sent: Wednesday, October 28, 2020 2:41 AM To: nodejs/help [email protected] Cc: siddjain [email protected]; Author [email protected] Subject: Re: [nodejs/help] (node:87) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit (#3040)
add a log above the process.on('unhandledRejection', ...) and see how often it is logged. those 11 eventlisteners have to come from somewhere
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnodejs%2Fhelp%2Fissues%2F3040%23issuecomment-717815661&data=04%7C01%7C%7Cc53be200647849245f0a08d87b25985b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637394748678242731%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ZvVGFPlNi3iPF0JHjF21nlMt6vnESYqUSAcnzQliFdE%3D&reserved=0, or unsubscribehttps://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAFZEMJGIHMUSFNBV3YVAT3SM7RLFANCNFSM4TBSBO5Q&data=04%7C01%7C%7Cc53be200647849245f0a08d87b25985b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637394748678252725%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=NF0wQcAXc0NJlKE6jkRrevoH4zRYUPvxSTHT1eEndVo%3D&reserved=0.
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.
@siddjain any updates on this issue? Did you get a chance to try with latest nodejs version
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.
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.