-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
fix: Memory leak on client.js 'connected' event #348 #362
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a unit test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a test of the original "memory leak warning" that it claims to fix.
The code is ok, the test on the EventEmitter warning is missing |
@mcollina What do you mean? This ?
|
Without the queue fix the test fails so it tests also EventEmitter warning now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@mcollina Can I merge this or need to wait reviwers? |
please wait for a bit |
Why we need to queue all packets between CONNECT and connected event? Line 93 in f62a343
|
@gnought We need to queue packets because like you can see in issue #348 after the first connect packet is received all other packet init a listener to connect event here and this throws the eventemitter warning |
The memory leakage occurs obviously we are keeping add listener in a same 'connected' event, and over the default limit 10 in https://nodejs.org/docs/latest-v12.x/api/events.html#events_emitter_setmaxlisteners_n Currently we hook I think we should drop all packets before there is a
|
Rejecting packets before "connected" event makes sense. We could get rid of unauthenticated packets. Clients should see if the connection is ready like ioredis ready event. |
Yes, we can, but the fix does not convince me. |
I think we can error the client after |
@mcollina Life, universe and everything ? I'm 👍 for configurable amount of messages. |
@mcollina Should be ok now? |
It sounds like that we still queue messages after connected. |
After connected event all queued packets are processed and the queue is set to null
I think that this problem would be the same with or without the initial queue, if the incoming messages are faster then the processing rate simply we get a stack overflow but this would not be caused by the queue |
@mcollina So what about this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, I've left a few nits to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code is ok, can you revert the linting changes to the typescript file?
@mcollina done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
If you’d like to change linting, add a PR with a linter for the ts files.
@mcollina I don't know which ide you are using, if everyone is using vscode we could add .vscode folder with all the formatters used (maybe another PR for this) |
I prefer integrations that are validated by CI, not by the editor. |
(I use vim) |
this conflicts with master now |
@mcollina It doesn't really conflicts it just fails the coverall tests as now What should I do? |
The coverage is decreesed by 0.04% causing that red cross on ci but all other tests are good. Should we create a separate job for coverage? |
increase unit test coverage
Il 29 gen 2020, 08:10 +0100, Daniel Lando <[email protected]>, ha scritto:
… The coverage is decreesed by 0.04% causing that red cross on ci bu all other tests are good. Should be create a separate job for coverage?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
No description provided.