Repository navigation
fix(http2): tolerate stream errors after response completion - #933
Open
rupayon123 wants to merge 1 commit into
Open
rupayon123 wants to merge 1 commit into
rupayon123 wants to merge 1 commit into
Conversation
When a response ends before a streamed request body finishes, the handler clears its request. A later stream error must still close the HTTP/2 channel without force-unwrapping that completed request. Add a deterministic EmbeddedChannel regression for response-end then stream-error ordering.
This branch has not been deployed
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.
Summary
Fixes #922. When a streaming request has already delivered its response end, a later HTTP/2 stream error can reach
failRequestafter the handler cleared its request. The handler now safely skips the second request failure while still closing the HTTP/2 channel and clearing timeout state.Reproduction and validation
HTTP2ClientRequestHandler.EmbeddedChannelregression for a streamed request, successful response end, then a later stream error.swift test --filter HTTP2ClientRequestHandlerTests/testErrorAfterResponseEndWhileRequestBodyIsStreamingDoesNotCrashpassed.swift test --filter HTTP2ClientRequestHandlerTestspassed.swift format lint --strict --configuration .swift-format ...andgit diff --checkpassed.The attached end-to-end reproducer uses a localhost test certificate and does not contact an external host. The unit test verifies handler state and channel closure; it does not replace the end-to-end reproduction.
AI assistance: OpenAI Codex assisted with the investigation and draft. I reviewed the diff and ran the checks listed above.