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

Possible EventEmitter memory leak detected #1

Closed
Thomas-Smyth opened this issue Dec 17, 2018 · 3 comments · Fixed by #3
Closed

Possible EventEmitter memory leak detected #1

Thomas-Smyth opened this issue Dec 17, 2018 · 3 comments · Fixed by #3

Comments

@Thomas-Smyth
Copy link

Hello,

I've been using a fork of this repository, however, this issue seems to be inherited from here.

I am using the repository to poll a server once every so often to get player count details. After around 9 .execute() calls, the following warning is thrown:

(node:12752) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added. Use emitter.setMaxListeners() to increase limit

It looks as if your code is not removing listeners after the returning the response. To test this I editted your write function to remove the .on('data', onData) just before the promise is resolved. This seems to have prevented the warning, however, I am not sure on what effect it will have on multi-packet responses. Is this something that you could look into?

Thanks in advance.

@Taraman17
Copy link
Contributor

Seeing the same issue.
Are you still maintaining this?

@Thomas-Smyth
Copy link
Author

@Taraman17 based on the lack of response to this issue I assume not.

Please refer to my fork for a possible fix... Thomas-Smyth@8de4d8e

EnriqCG pushed a commit that referenced this issue Apr 26, 2020
Add support for Multi-Packet Responses and fix listener-leak fixes #1
@EnriqCG
Copy link
Owner

EnriqCG commented Apr 26, 2020

Thanks to @Taraman17's work this issue has been finally fixed. Listeners are now being removed correctly 🎉

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

Successfully merging a pull request may close this issue.

3 participants