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

(node) warning: possible EventEmitter memory leak detected. 11 listeners added #661

Closed
DmitrySoshnikov opened this issue Jun 17, 2015 · 4 comments

Comments

@DmitrySoshnikov
Copy link

We tried switching from Q to bluebird in the Jest project, and started constantly to get this warning:

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
  at process.addListener (events.js:160:15)
  at process.on.process.addListener (node.js:802:26)
  at /Users/dmitrys/jest/node_modules/bluebird/js/main/async.js:80:25
  ....

We ran many tests in parallel, seems many promises are created, but Q didn't have this issue.

@DmitrySoshnikov
Copy link
Author

We can fix it in our code by setMaxListeners(n):

process.setMaxListeners(0);

Although, probably bluebird may want to do the same in here.

@bgw
Copy link

bgw commented Jun 23, 2015

I'd argue this isn't something that bluebird should do, as it has global side-effects, and because it can already be fixed on the application's (or in this case, jest's) side. Plus, it might cover up real leaks, though 10 seems like a pretty arbitrarily low value. We probably only get the error in jest because of the software's complexity.

@benjamingr
Copy link
Collaborator

Bluebird is just adding 1 handler here (per instance) if I understand
correctly so it's really not up to bluebird to put that limit at a very
high number because as the previous comment said it might cover up a real
issue.

On Tue, Jun 23, 2015 at 8:17 PM, Benjamin Woodruff <notifications@github.com

wrote:

I'd argue this isn't something that bluebird should do, as it has global
side-effects, and because it can already be fixed on the application's (or
in this case, jest's) side. Plus, it might cover up real leaks, though 10
seems like a pretty arbitrarily low value. We probably only get the error
in jest because of the software's complexity.


Reply to this email directly or view it on GitHub
#661 (comment)
.

@bergus
Copy link
Contributor

bergus commented Jun 23, 2015

Well, Bluebird could do

if (process._maxListeners)
    process.setMaxListeners(process._maxListeners + 1);

if there is really a need for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants