Fix for server.connections being too low #431

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

cyraxx commented Nov 17, 2010

When using node with socket.io, I noticed that the server's 'connections‘ property was way too low, often even becoming negative. I found out that Stream.destroy() was being called more than once, each time decreasing the connection counter again.

I fixed this by setting a flag when destroy() has been called. The connection count now matches netstat's output.

If there's a better way to implement/fix this, please let me know.

ry commented Nov 22, 2010

i'd really like a test for when this happens. is it when people call stream.destroy() twice?

cyraxx commented Nov 23, 2010

Yes, when stream.destroy() is called twice, the connection count is decreased twice.

Socket.io calles destroy() twice because apparently a timeout isn't cleared. While this is probably a bug in socket.io, node should still ensure the connection count is correct.

aconbere commented Dec 8, 2010

ry#502

I wrote up a test for this behavior.

cyraxx commented Mar 2, 2011

Any chance on this being pulled? AFAIK it's still broken.

cyraxx commented Mar 4, 2011

Don't decrease server connection counter again if destroy() is called more than once

Test: Anders Conbere <aconbere@gmail.com>
Fix: Andreas Reich <andreas@reich.name>

Closed by 5e91042.
Closed by 5e91042.

ry commented Mar 4, 2011

Thanks Anders and Andreas

@coolaj86 coolaj86 pushed a commit that referenced this pull request Apr 15, 2011

@cyraxx @ry cyraxx + ry Don't decrease server connection counter again if destroy() is called…
… more than once

Test: Anders Conbere <aconbere@gmail.com>
Fix: Andreas Reich <andreas@reich.name>

Closes GH-431.
Closes GH-502.
5e91042

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment