(3.6.2) Maximum event emitters exceeded
See original GitHub issueWe started evaluating gulp for migrating a big JS project to and ran into the following problem:
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at StatWatcher.EventEmitter.addListener (events.js:176:15)
at Object.fs.watchFile (fs.js:1142:8)
at Gaze._pollFile (/Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:329:10)
at /Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:411:12
at Array.forEach (native)
at /Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:409:11
at iterate (/Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5)
at /Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:61:11
at /Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:420:5
at iterate (/Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5)
I looked into the issue and it seems as if it should be resolved with node 0.11, however it still seems to persist:
Running node v0.11.12
[gulp] Using gulpfile ~/jimdo/gulpfile.js
[gulp] Starting 'watch'...
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at StatWatcher.EventEmitter.addListener (events.js:176:15)
at Object.fs.watchFile (fs.js:1142:8)
at Gaze._pollFile (/Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:329:10)
at /Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:411:12
at Array.forEach (native)
at /Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:409:11
at iterate (/Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5)
at /Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:61:11
at /Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:420:5
at iterate (/Users/joscha/jimdo/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5)
My next approach was to try and increase the event emitter size in the target project (Gaze), however it seems as if gulp uses a slightly older version (0.5.1) than the current.
I believe setting the maximum event listeners could be done here (https://github.com/shama/gaze/blob/dad5345a2876346fe49a68ee6e4db34205680798/lib/gaze.js), but that would make me need to not only fork gulp, but the whole chain (gulpjs -> vinyl-fs -> glob-watcher -> gaze
) which does not seem to be maintainable.
Any other ideas on this?
Issue Analytics
- State:
- Created 9 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
possible EventEmitter memory leak detected - node.js
I'd like to point out here that that warning is there for a reason and there's a good chance the right fix is...
Read more >Node.js sends warnings when you add too many listeners to ...
Node.js gives friendly warnings in case you add too much event listeners to an event emitter.
Read more >Summary for Policymakers — Global Warming of 1.5 ºC - IPCC
A.3.2. Future climate-related risks depend on the rate, peak and duration of warming. In the aggregate, they are larger if global warming exceeds...
Read more >What's New In Python 3.6 — Python 3.11.1 documentation
New run_coroutine_threadsafe() function to submit coroutines to event loops ... repeated 995 more times] RecursionError: maximum recursion depth exceeded.
Read more >MIL-STD-750D, Test Methods for Semiconductor Devices
Thermal resistance (emitter to base forward voltage, emitter-only switching ... When the junction temperature exceeds the device maximum rated junction ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can pass options down to gaze with the optional second argument:
gulp.watch(files, { maxListeners: 999 }, ['minJsFiles'])
gaze@0.5.x
just has an issue when settingmaxListeners: 0
, it should set them to infinite but currently it ignores the option (but fixed on0.6.x
).Good to know, thanks for the update !