http2: fix async context loss when trailers carry END_STREAM#63814
Open
orgads wants to merge 1 commit into
Open
http2: fix async context loss when trailers carry END_STREAM#63814orgads wants to merge 1 commit into
orgads wants to merge 1 commit into
Conversation
Collaborator
|
Review requested:
|
The previous fix (f67e45e) wrapped header/response event dispatch in reqAsync.runInAsyncScope(), but missed the stream.push(null) call that triggers the 'end' event. When END_STREAM arrives on a trailing HEADERS frame (as gRPC does), the 'end' event fires in the session's async context instead of the request's context. Wrap stream.push(null) at end-of-stream in reqAsync.runInAsyncScope() so that the 'end' event preserves the correct AsyncLocalStorage context. Refs: nodejs#55460 Signed-off-by: Orgad Shaneh <orgad.shaneh@audiocodes.com>
00f4171 to
a39d251
Compare
Qard
approved these changes
Jun 9, 2026
Contributor
Author
|
The macOS failure looks unrelated to my change. |
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.
The previous fix (f67e45e) wrapped header/response event dispatch in
reqAsync.runInAsyncScope(), but missed thestream.push(null)call that triggers the'end'event. WhenEND_STREAMarrives on a trailingHEADERSframe (as gRPC does), the'end'event fires in the session's async context instead of the request's context.Wrap the
stream.push(null)at end-of-stream inreqAsync.runInAsyncScope()so that the'end'event preserves the correct AsyncLocalStorage context.Refs: