question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Too many listeners

See original GitHub issue

When sending a transaction, I get an error:

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

It’s coming from the Filter subprovider onFilterChange _ready.on method. That _ready object needs its listener max raised, or has a memory leak.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
riteablecommented, Sep 27, 2017

I don’t seem to have this issue in the browser, but I do get the warning in Node.js.

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unlock listeners added. Use emitter.setMaxListeners() to increase limit
    at _addListener (events.js:262:19)
    at Stoplight.addListener (events.js:279:10)
    at Stoplight.once (events.js:308:8)
    at Stoplight.await (/.../node_modules/web3-provider-engine/util/stoplight.js:30:10)
    at FilterSubprovider.handleRequest (/.../node_modules/web3-provider-engine/subproviders/filters.js:69:24)
    at next (/.../node_modules/web3-provider-engine/index.js:112:18)
    at Web3ProviderEngine._handleAsync (/.../node_modules/web3-provider-engine/index.js:99:3)
    at /.../node_modules/async/internal/map.js:27:9
    at eachOfArrayLike (/.../node_modules/async/eachOf.js:65:9)
    at exports.default (/.../node_modules/async/eachOf.js:9:5)
    at _asyncMap (/.../node_modules/async/internal/map.js:25:5)

I’m using 0x on the server side and using the web3 provider engine to listen to certain 0x log events (fill, cancel, error). I’ve added the filter and RPC subproviders. The RPC subprovider is connected to Infura.

1reaction
ghostcommented, Apr 25, 2017

Adding this line to the top of server.js makes the error not show up again: require('events').EventEmitter.prototype._maxListeners = 100;

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does adding too many event listeners affect performance?
In terms of performance, the number of elements the event is bound to is where you'd see any issues. Here is a jsperf...
Read more >
sudden "too many listeners on GPIB" error - NI Community
Solved: Out of the blue, I am suddenly dealing with this "too many listeners on the GPIB" error, and my PC could no...
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 >
Will too many listeners and routes affect performance? #29684
I have a k8s cluster with about 500 services, and then I use istio to manage a project. But I checked the listener...
Read more >
1.16.5 - Register too many listeners | SpigotMC - SpigotMC
I have lots of objects, which represent a type of item, each object listens to separate events and acts when that event occurs....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found