-
-
Notifications
You must be signed in to change notification settings - Fork 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
Fix premature close with chunked transfer encoding (Node 10+) and for async iterators in Node 12 #1064
Fix premature close with chunked transfer encoding (Node 10+) and for async iterators in Node 12 #1064
Conversation
9cf8c18
to
858b7ed
Compare
Very excited for this fix! 😄 |
@davidje13 @xxczaki @Richienb I'm seeing anecdotal evidence from multiple sources that this change fixes a large set of issues with stalling requests. I think it would be beneficial to get your reviews so we can merge and release an updated beta. |
Hey @tekwiz is there a plan to release this bugfix in a new |
are these changes released to |
@ran-kalir @oed I will release |
Ok, that's unfortunate. When is v3 slated for release? Or any way to backport this fix? |
Hey @xxczaki, any update on getting this backported to v2? This is causing major problems for us that is getting in the way of our product launch. (see #1055 and ipfs/js-ipfs#3465 which inspired it) |
@stbrody can you send a pull request agains the v2 branch? |
What is the purpose of this pull request?
What changes did you make? (provide an overview)
re. 47b00e1: For responses using chunked
Transfer-Encoding
without aContent-Length
, this adds a check at the socket'sclose
event to verify that the last bytes received were the final chunk bytes, i.e.0\r\n
. If not, it creates aPremature close
error and sends it toresponse.body.destroy()
. Certain network errors evidently bypass the HTTP parser's error handling resulting in silent failures. @davidje13 confirmed fix in #739 #739 (comment).re. 13cdcf3: Before Node.js 14, pipeline() does not fully support async iterators and does not always properly handle when the socket close/end events are out of order. This fix emits a
Premature close
error if the socket's readableend
event occurs before the writableclose
event.re. 9cf8c18: Usage of async iterators for both Node.js 12 and 14 is added to the README.
Which issue (if any) does this pull request address?
#739 #766 #968 #1055 #1056 and possibly #736
Is there anything you'd like reviewers to know?