Repository navigation
fix(binding-http): reset streaming response on remote client disconnect - #1850
Merged
Merged
Conversation
For an HTTP/1.1 server exchange whose request is already complete but whose response is still streaming (e.g. Server-Sent Events), a graceful client disconnect arrives as a network END. HttpExchange.onNetworkEnd only aborted the request and left the open response untouched, so the application's response stream was never reset and was only reaped by inactivity. This is inconsistent with HTTP/2, which resets the reply on END via cleanup. When the response is OPEN on network END, reset it and abort the network reply, mirroring the existing onDecodeBodyInvalid path. The responseState == OPEN guard preserves the valid HTTP half-close case (client closes its request side then reads the full response), which completes via the existing replyCloseOnFlush path. Add server IT client.close.during.response: a streaming response is reset (write aborted) when the client closes the connection mid-response. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…t close Mirror the rfc7230 client.close.during.response scenario for HTTP/2: a server exchange whose request is complete but whose response is still streaming is reset (write aborted) when the client closes the connection mid-response. HTTP/2 already handles this via Http2Server cleanup on network END; this locks in parity with the HTTP/1.1 fix. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This was referenced Jun 8, 2026
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.
Problem
For an HTTP/1.1 server exchange whose request is already complete but whose response is still streaming (e.g. Server-Sent Events), a graceful client disconnect arrives as a network
END.HttpExchange.onNetworkEndonly aborted the request and left the open response untouched, so the application's response stream was never reset and was only reaped later by the inactivity timeout. This is inconsistent with HTTP/2, which resets the reply onENDvia cleanup.Change
OPENon networkEND, reset it and abort the network reply, mirroring the existingonDecodeBodyInvalidpath. TheresponseState == OPENguard preserves the valid HTTP half-close case (client closes its request side then reads the full response), which still completes via the existingreplyCloseOnFlushpath.rfc7230 .../client.close.during.response: a streaming response is reset (write aborted) when the client closes the connection mid-response.rfc7540(HTTP/2) scenario to lock in parity — HTTP/2 already handles this viaHttp2Servercleanup on networkEND; the test pins the behavior.Verification
./mvnw clean verify -pl runtime/binding-httpis green. The newshouldResetResponseWhenClientClosesDuringResponseruns in both the rfc7230 and rfc7540 serverConnectionManagementITs; all fourConnectionManagementITclasses pass.🤖 Generated with Claude Code