Timeout for handshaken clients which never connect to fix memory leak #445
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Under some circumstances there seem to be clients which only perform one handshake and are then never seen again. I don't know the exact source of the problem, but it shouldn't affect the server. However, this problem introduces a memory leak in manager.js. The clients are not correctly removed from the "handshaken" member in manager.js, leading to a memory leak and frequent crashes of the server because of constantly increasing load and cpu (most probably because of operations on this member taking longer and longer).
Here is a graph to illustrate the problem:
http://img684.imageshack.us/img684/9707/handshakememleak.png
(The drop at around 18:00 was the result of a crash)
The fix introduces a timeout which fires after the "client store expiration" and checks if the client has connected within the given interval. If he hasn't, the client is deleted from the "handshaken" member. This fixes the problem of the evergrowing "handshaken" member.