-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Client response pause/resume does not work with non-keepalive connection #5787
Comments
I believe I know the cause of this problem. Since the server isn't using a keep alive connection, it is closing the socket once the reply is complete. Calling shutdown() then close() on the socket. The client, by pausing the data stream keeps some tcp data buffered. Before it is able to read all of the data off of the socket it receives a TCP reset packet causing signaling the socket has been closed by the server, which in turn causes the aborted event to be emitted. This is all explained in much more depth here: http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable Node does not implement a lingering close, or use the SO_LINGER option from the sources I've read in 0.12. It normally wouldn't need to because, most web connections are keep-alive now and with luck this problem wouldn't be rearing its complicated head but it is in this case. @bnoordhuis Are you interested in a lingering close implementation in http.js for non keep-alive connections? Or a patch to add SO_LINGER support? |
I'm not sure that's the case, as it seems to be working with latest master after the streams3 changes that @isaacs made |
Right, that works correctly in master now, how about 0.8 and 0.10 branches? |
I don't want to derail this issue so if you want to continue the conversation please open a new one or post to the mailing list but the short answer is 'no' and that's because the slightly longer answer is 'because it introduces as many problems as it solves.' |
@tjfontaine Could you please reopen this for 0.10 fix or comment if it's not going to be ported there? |
Doing pause/resume on response for a request with connection: close header results in 'aborted' event, 'end' is emitted afterwards as well.
Copying sample code from node-formidable/formidable#240 (tried out with 0.8, 0.10 and 0.11).
The text was updated successfully, but these errors were encountered: