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

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. #925

Closed
markNZed opened this issue Oct 4, 2023 · 1 comment
Closed
Labels

Comments

@markNZed
Copy link

markNZed commented Oct 4, 2023

Describe the bug
Every time we create a Redis keyv an event is added to monitor Redis errors

this.redis.on('error', (error: Error) => this.emit('error', error));

If we add many keyv this is going to exceed the default max number of listeners (10).

The warning looks like:

(node:19415) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [Commander]. Use emitter.setMaxListeners() to increase limit

I'm unsure if this is a bug - the default limit can be raised. I'm not sure of a good way to address this without adding a lot of complication. I thought I would mention it in case someone does see a solution.

@markNZed markNZed added the bug label Oct 4, 2023
@jaredwray
Copy link
Owner

What we have seen is that people just increase the max listeners when they are using multiple instances. Also, we will be looking to change this in v5 👉 #868

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

No branches or pull requests

2 participants