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

I'm getting a "Too many listeners warning" when I add the 11th liveFeed #4

Open
brunoreis opened this issue Sep 14, 2017 · 4 comments

Comments

@brunoreis
Copy link

Should that happen? I am asking because of the following comment lines:

// We will use just one change listener for all live queries.
// We need to keep track of how many queries are running.
// When the last live query finishes we will cancel the listener.
@brunoreis
Copy link
Author

The error is "console.error: "(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit."

@brunoreis
Copy link
Author

It seems that you just postponed the message because when you call:

db._changeListener
    .on('change', changeHandler)
    .on('error', errorHandler);

it's throwing that error on the _changeListener now. I'm not sure if this will improve performance (adding listeners on the changeListener instead of on the db) because I've not traced it's implications.

But, anyway, it's good to know that you can do a:

db._changeListener.setMaxListeners(30);

after you register your first finder to fix this. At least for now.

@colinskow
Copy link
Owner

If you've added 11 listeners and the warning says 11 listeners added, that is normal. (Increase max listeners if you need more.) If you add 11 listeners and it says you have 100 listeners added, that is a memory leak.

@colinskow
Copy link
Owner

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

No branches or pull requests

2 participants