Guard request half-close abort on readableEnded - #771
Closed
nstandif wants to merge 6 commits into
Closed
Conversation
The runtime closes the request body once the journal is fully streamed in REQUEST_RESPONSE mode while the response stays open awaiting output, which fires "close" on a still-suspended handler and killed it with a spurious "(500) Connection closed". Only abort when "close" fires before the request has actually ended.
nstandif
marked this pull request as draft
July 29, 2026 02:43
nstandif
marked this pull request as ready for review
July 30, 2026 05:39
Both IncomingMessage and Http2ServerRequest already extend it directly, so it's the real common interface, not something to reinvent.
nstandif
force-pushed
the
worktree-fix-abort-request-response
branch
from
July 30, 2026 06:05
c55f5bd to
c4a3870
Compare
nstandif
force-pushed
the
worktree-fix-abort-request-response
branch
2 times, most recently
from
July 30, 2026 06:33
b071c8b to
00a2cb6
Compare
Contributor
|
This should have been fixed by #787 and been released in 1.16.9. Please reopen the issue if still not resolved |
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.
Closes #745.
Depends on #774 (unrelated e2e test issue this change exposes; CI won't be green here until that merges).
In REQUEST_RESPONSE mode, the runtime half-closes the request after the journal is delivered and keeps the response open for the reply. The request's "close" event was aborting the invocation unconditionally, killing any handler suspended on a call or promise. Surfaced as
[500] Connection closedplus a retry loop.completecan't distinguish a clean half-close from a mid-stream RST on Node 24 (both read true).readableEndedcan: it's only true after the stream actually saw "end".Fix: gate the abort on
!request.readableEnded, extracted intoabortSignalForRequest.Added
test/node_endpoint.test.tsagainst a realnode:streamReadable. Confirmed the test fails without the guard before adding it. Suite and typecheck pass.No public API change, so no changeset. Flag if you want a release note anyway.