http: prevent reuse after incomplete request destruction - #65674
Open
dayun6530 wants to merge 1 commit into
Open
http: prevent reuse after incomplete request destruction#65674dayun6530 wants to merge 1 commit into
dayun6530 wants to merge 1 commit into
Conversation
Collaborator
|
Review requested:
|
dayun6530
marked this pull request as ready for review
August 31, 2026 01:04
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65674 +/- ##
==========================================
+ Coverage 90.06% 90.19% +0.13%
==========================================
Files 754 771 +17
Lines 255747 264631 +8884
Branches 48318 50233 +1915
==========================================
+ Hits 230327 238689 +8362
- Misses 16550 16945 +395
- Partials 8870 8997 +127
🚀 New features to boost your workflow:
|
ronag
requested changes
Aug 31, 2026
ronag
left a comment
Member
There was a problem hiding this comment.
Something more fundamental is wrong here. The socket should not be re-used if destroyed without being fully consumed and anything else in the pipeline queue should also be cancelled.
Member
Signed-off-by: Dayun <dlekdbs6530@gmail.com>
dayun6530
force-pushed
the
fix/http-stream-early-termination
branch
from
September 6, 2026 22:57
6d8cf43 to
9573192
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs: #49429
When a server
IncomingMessageis consumed with an async iterator and iteration terminates before the request body is fully consumed, the stream destroy path detaches the request from its socket before destroying it. This leaves the underlying keep-alive connection open even though the request was not fully consumed.Unread request body data can then reach the destroyed stream, pause the socket, and make a subsequent request that reuses the same connection stall.
This change prevents that connection from being reused:
Connection: closeand the socket is not reused.The request stream is then detached and destroyed as before.
Regression tests cover both cases:
Connection: close, and the next request uses a new socket;ECONNRESET, and the next request uses a new socket.Tests:
make lint-jspython3 tools/test.py --mode=release test/parallel/test-http-server-for-await-keepalive.js test/parallel/test-http-server-for-await-keepalive-headers-sent.jspython3 tools/test.py --mode=release test/parallel/test-stream-destroy.js test/parallel/test-http-server-incomingmessage-destroy.js test/parallel/test-http-incoming-pipelined-socket-destroy.js