Fix h3 connection-level and stream-level abort locking - #68102
Draft
cincuranet wants to merge 3 commits into
Draft
Fix h3 connection-level and stream-level abort locking#68102cincuranet wants to merge 3 commits into
cincuranet wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a potential deadlock in Kestrel’s HTTP/3 stream abort paths when connection-level and stream-level aborts interleave with inline output flushing, and adds coordination to ensure abort side-effects complete before a stream is disposed/pooled.
Changes:
- Refactors
Http3Stream.AbortCoreso only the completion-state transition occurs under_completionLock, with abort side-effects executed outside the lock to avoid lock-order deadlocks withHttp3OutputProducer._dataWriterLock. - Adds an abort-completion
TaskCompletionSourceand aCompleteAndWaitForAbortAsync()helper so request finalization can await in-flight abort side-effects before disposal/pooling. - Updates request finalization to mark the stream completed earlier and wait for any in-flight abort prior to draining/disposing the transport.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
cincuranet
marked this pull request as ready for review
July 31, 2026 09:01
cincuranet
marked this pull request as draft
July 31, 2026 13:02
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.
Fixes #68101