Conversation
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65674 +/- ##
==========================================
- Coverage 92.77% 90.37% -2.40%
==========================================
Files 422 792 +370
Lines 192675 275576 +82901
Branches 29668 52826 +23158
==========================================
+ Hits 178746 249059 +70313
- Misses 13604 16914 +3310
- Partials 325 9603 +9278
🚀 New features to boost your workflow:
|
ronag
left a comment
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.
6d8cf43 to
9573192
Compare
9573192 to
04372aa
Compare
04372aa to
5289e7d
Compare
|
Thanks for the review. I've updated the change so that an incompletely consumed request prevents the underlying connection from being reused, and added regression tests for both the headers-not-sent and headers-already-sent cases. The remaining Test Shared libraries failure is from test-tick-processor-arguments.js timing out on x86_64-darwin, which appears unrelated to this change. @ronag Could you please take another look when you have a chance? A re-run of the failed CI job would also be appreciated. |
|
@ronag Just following up on the Sep 10 update. |
|
My understanding is that the fix for this needs to happen in http, not in streams. |
Signed-off-by: Dayun <dlekdbs6530@gmail.com>
5289e7d to
70234e9
Compare
|
Thanks for the feedback. I've moved the fix out of the streams implementation and into HTTP handling in The regression tests still cover both cases:
I've also rebased onto the current @mcollina @ronag Could you please take another look when you have a chance? Thanks! |
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