This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Response 'finish' sometimes called before stream completely written #5712
Comments
Actually, no this didn't fix the issue. |
if instead of calling req.destroy() req.socket.destroySoon is called it works. |
I tried upgrading to node 0.10.12 and this is still an issue. |
Confirmed. This is definitely a bug, and not a dupe. |
To clarify: 'finish' should not happen before the last written chunk is flushed. |
isaacs
added a commit
to isaacs/node-v0.x-archive
that referenced
this issue
Jun 24, 2013
Closes nodejs#5712 When ending, if there is a pending write, don't emit finish until the subsequent close or drain event, so that we know it's fully flushed.
See #5739 (comment) Bottom line: We can't make this guarantee for HTTP streams. When 'finish' emits, it means that it's been sent to the socket, but NOT that it's necessarily made it to the client successfully. I think that this sucks. But, if we try to make this guarantee, it'll fail for HTTPS streams anyway, and there's no way to fix that prior to 0.12. |
tjfontaine
added a commit
to tjfontaine/node
that referenced
this issue
Jul 1, 2013
A pooled https agent may get a Connection: close, but never finish destroying the socket as the prior request had already emitted finish likely from a pipe. Since the socket is not marked as destroyed it may get reused by the agent pool and result in an ECONNRESET. re: nodejs#5712 nodejs#5739
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This is a difficult issue to reproduce, but I have narrowed it down to the following reproducing code:
The key is to have a decent sized biggie.js file to try sending, mine needed to be over 2mb.
When you run the above code you should see the exception, if not try increasing the size of biggie.js.
The text was updated successfully, but these errors were encountered: