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

EventEmitter warnings about too many listeners #524

Closed
dmp42 opened this Issue Jan 16, 2014 · 6 comments

Comments

Projects
None yet
4 participants
@dmp42
Contributor

dmp42 commented Jan 16, 2014

I am testing with a large number of rules - whenever I get over a number of rules, the following is emitted:

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at EventEmitter.addListener (events.js:160:15)
    at /Users/dmp/dev/jsboot/gulp-webitup/node_modules/gulp-eslint/node_modules/eslint/lib/eslint.js:284:29
    at Array.forEach (native)
    at /Users/dmp/dev/jsboot/gulp-webitup/node_modules/gulp-eslint/node_modules/eslint/lib/eslint.js:283:39
    at Array.forEach (native)
    at EventEmitter.module.exports.api.verify (/Users/dmp/dev/jsboot/gulp-webitup/node_modules/gulp-eslint/node_modules/eslint/lib/eslint.js:268:16)
    at verify (/Users/dmp/dev/jsboot/gulp-webitup/node_modules/gulp-eslint/index.js:22:21)
    at /Users/dmp/dev/jsboot/gulp-webitup/node_modules/gulp-eslint/index.js:39:19
    at wrappedMapper (/Users/dmp/dev/jsboot/gulp-webitup/node_modules/gulp-eslint/node_modules/event-stream/node_modules/map-stream/index.js:76:19)
    at Stream.stream.write (/Users/dmp/dev/jsboot/gulp-webitup/node_modules/gulp-eslint/node_modules/event-stream/node_modules/map-stream/index.js:88:21)
    at Stream.method [as write] (/Users/dmp/dev/jsboot/gulp-webitup/node_modules/gulp-util/node_modules/stream-combiner/node_modules/duplexer/index.js:47:39)

It seems that setting a (way) higher limit on the api object in eslint/lib/eslint.js:284 "fixes" (or workaround) the problem.

What's your position on this?

Thanks a lot for a great project!

@michaelficarra

This comment has been minimized.

Show comment
Hide comment
@michaelficarra

michaelficarra Jan 16, 2014

Member

Yeah, this seems like a situation where using setMaxListeners is appropriate.

Member

michaelficarra commented Jan 16, 2014

Yeah, this seems like a situation where using setMaxListeners is appropriate.

@dmp42

This comment has been minimized.

Show comment
Hide comment
@dmp42

dmp42 Jan 16, 2014

Contributor

Ok... I don't feel really at ease with eslint/code yet - shall I go ahead and just setMaxListeners to some arbitrary (higher) value? Opinion? :-)

Thanks a lot!

Contributor

dmp42 commented Jan 16, 2014

Ok... I don't feel really at ease with eslint/code yet - shall I go ahead and just setMaxListeners to some arbitrary (higher) value? Opinion? :-)

Thanks a lot!

@nzakas

This comment has been minimized.

Show comment
Hide comment
@nzakas

nzakas Jan 18, 2014

Member

Agree. I think we can safely set it to be equal to the number of rules being used (since each rule can only listen to each event once).

Member

nzakas commented Jan 18, 2014

Agree. I think we can safely set it to be equal to the number of rules being used (since each rule can only listen to each event once).

@ilyavolodin

This comment has been minimized.

Show comment
Hide comment
@ilyavolodin

ilyavolodin Jan 18, 2014

Member

Sorry, I might be confused (there's a lot of that lately) but a lot of our rules listen to more then one event. api.on is triggered for every node type that a rule subscribes to, and rules can subscribe to listen to multiple nodes. Right?

Member

ilyavolodin commented Jan 18, 2014

Sorry, I might be confused (there's a lot of that lately) but a lot of our rules listen to more then one event. api.on is triggered for every node type that a rule subscribes to, and rules can subscribe to listen to multiple nodes. Right?

@nzakas

This comment has been minimized.

Show comment
Hide comment
@nzakas

nzakas Jan 18, 2014

Member

Yes, but the listener limit is per event emitted. Each node type is a different event.

Member

nzakas commented Jan 18, 2014

Yes, but the listener limit is per event emitted. Each node type is a different event.

@nzakas

This comment has been minimized.

Show comment
Hide comment
@nzakas

nzakas Jan 18, 2014

Member

I'm just going to set the max to 0, which makes it unlimited. That should solve the problem (which had just started showing up for me running npm test).

Member

nzakas commented Jan 18, 2014

I'm just going to set the max to 0, which makes it unlimited. That should solve the problem (which had just started showing up for me running npm test).

@nzakas nzakas closed this in 7a7187e Jan 18, 2014

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.