v12.16.1
macOS 10.15.3
Getting the following error message when making multiple requests with got
:
(node:60669) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [KeyvMemcache]. Use emitter.setMaxListeners() to increase limit
For got/keyv to:
I expect this behavior especially when .extend
ing:
const extendedGot = got.extend({ cache });
got
, and got
passes that into Keyv
, which adds the event listener.on
, but in practice I'm using keyv-memcache, which extends the EventEmitter which is what makes the warning about the memory leakconst got = require('got');
const cache = new Map();
cache.on = function(eventName) {
console.trace(eventName);
};
// Individual calls
for (let i = 0; i < 10; i++) {
got('http://google.com', { cache });
}
// Extended calls
const extendedGot = got.extend({ cache });
for (let i = 0; i < 10; i++) {
extendedGot('http://google.com');
}
For what it's worth, I also read #792, https://github.com/lukechilds/cacheable-request/issues/30, and #921 (the "click for solution" link is broken for me) but I believe the problem is different.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too