-
Notifications
You must be signed in to change notification settings - Fork 5.7k
fix(node/http): resolve stream.finished() hanging on destroyed server requests #30580
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
Open
gitstart-app
wants to merge
10
commits into
main
Choose a base branch
from
DENB-29802-parallel/test-stream-finished.js
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
… requests IncomingMessageForServer was missing proper aborted state management, causing stream.finished() to hang when req.destroy() was called. - Add #aborted field and update aborted getter - Implement proper destroy() method with correct event emission - Add test to node compatibility suite - Handle edge cases and race conditions Fixes parallel/test-stream-finished.js hanging at line 579.
node:stream
tracking issue - parallel/test-stream-finished.js… requests IncomingMessageForServer was missing proper aborted state management, causing stream.finished() to hang when req.destroy() was called. - Add #aborted field and update aborted getter - Implement proper destroy() method with correct event emission - Add test to node compatibility suite - Handle edge cases and race conditions Fixes parallel/test-stream-finished.js hanging at line 579.
bartlomieju
requested changes
Sep 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that parallel/test-stream-finished.js
is actually hanging
…s hanging requests into proper timeout errors, matching Node.js behavior.
…shed() compatibility - Add connection termination error detection in Rust HTTP ops layer - Implement client-server request registry for error propagation - Fix FakeSocket destroy behavior with proper ECONNRESET emission - Enhance IncomingMessageForServer with proper destroy() method - Add stream state management for finished() compatibility - Enable parallel/test-stream-finished.js in Node.js compatibility suite Fixes failing Node.js compatibility test by implementing proper request destruction patterns that emit ECONNRESET errors when server calls req.destroy(), matching Node.js behavior.
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.
This PR was created by GitStart to address the requirements from this ticket: DENB-29802.
Summary
Fixes
parallel/test-stream-finished.js
in the Node.js compatibility suite by adopting Node.js-compatible patterns for HTTP request destruction and error propagation, restoring correctstream.finished()
behavior.Problem
req.destroy()
, client requests did not receive the expectedECONNRESET
.stream.finished()
misbehaved due to improper stream state management.Solution
ext/node/ops/http.rs
— detect termination conditions and map Hyper errors to Node.js-compatibleECONNRESET
.ext/node/polyfills/http.ts
— port-based registry to match client requests with server connections and signal them on destruction.FakeSocket
destroy semanticsProper socket destruction with error propagation to the corresponding client requests.
IncomingMessageForServer
Implement
destroy()
with aborted-state tracking and correct stream state handling.ClientRequest
cleanupRobust error propagation and registry cleanup on destruction.
finished()
ext/node/polyfills/_http_outgoing.ts
— add explicit error/finished flags forfinished()
compatibility.Key Features
ECONNRESET
propagation when the server destroys requests.finished()
.Files Changed
ext/node/ops/http.rs
— termination detection andECONNRESET
mappingext/node/polyfills/http.ts
— request registry,FakeSocket
destroy behavior, server/client integrationext/node/polyfills/_http_outgoing.ts
— state flags forfinished()
compatibilityTesting
parallel/test-stream-finished.js
ECONNRESET
) and cleanup