-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Closing a server does not disconnect clients #495
Comments
Isn't that Node.js core issue instead of a Socket.IO issue? I would say that Node should clean up all fd's when you want to close the server. |
Quite possibly, especially considering the server -still doesn't quit even after the client has disconnected- (Actually, it does quit, exactly 15 seconds later). If the listening socket were closed but the client socket wasn't closed, you'd expect closing the client socket to terminate the process at last. |
I just played with it - Given this server: server = require('http').createServer (req, res) ->
res.writeHead 200, 'Content-Type': 'text/plain'
res.write 'Hello world\n'
setTimeout (-> console.log 'closing'; server.close()), 1000
server.listen 4321 lazy client:
Just like with the socket.io code:
With the native node.js app, the server terminates as soon as the last client connection is closed. With socket.io, the server still closes on its own, but it waits a full 15 seconds after the last client manually disconnects and the process terminates. I think node.js is probably acting correctly according to its spec. It sort of makes sense to deal with the last http requests properly while a server is shutting down. .. But I don't think the behaviour is the right one in socket.io. (Terminating all the open connections is certainly what I expected to happen when I called |
Yes and no, we can just loop over all clients and send a disconnect() packet. So I'm marking this as bug. |
Does somebody look at this after so long time? Is this on roadmap for one of next release? |
dang, I just hit this issue when writing tests |
@JakubMal I'm interested in seeing the test. Could you please post it? |
@samsonradu sorry man, my bad! Should have checked twice... |
This server calls
s.server.close()
1 second after a client connects.... however, the client is never disconnected:
The text was updated successfully, but these errors were encountered: