Repository navigation
Http2: Reserve promised stream before running the request verifier - #17495
Merged
Merged
Conversation
Motivation: In DefaultHttp2ConnectionDecoder.onPushPromiseRead(), the promised stream was only reserved via reservePushStream() after the Http2PromisedRequestVerifier checks (isAuthoritative/isCacheable/ isSafe) passed. If the verifier rejected the promised request, the method threw before the stream was ever reserved, so the connection lost all bookkeeping of that stream ID's existence. Modification: - Move the reservePushStream() call ahead of the verifier checks in onPushPromiseRead(), so the promised stream is reserved as soon as the parent stream state is validated, and any subsequent verifier rejection fails an already-reserved stream instead of leaving no record of it. - Add a unit test that rejects a push promise via a custom verifier and asserts the stream was still reserved. Result: The promised stream ID's existence is always tracked once a PUSH_PROMISE is otherwise valid enough to reach verification.
bryce-anderson
approved these changes
Sep 16, 2026
… a stream error Motivation: Bryce Anderson suggested demonstrating that, since the promised stream is now reserved even when the request verifier rejects it, a follow-up frame on that stream ID is cleanly attributed to that stream (a StreamException) rather than surfacing as a broader connection error. Modification: - Enhance pushPromiseReadRejectedByVerifierShouldStillReserveStream to send a follow-up HEADERS frame for the rejected-but-reserved promised stream (simulating it having since been reset and closed) and assert the resulting exception is a STREAM_CLOSED stream error scoped to that stream ID. Result: Test coverage now shows the practical benefit of reserving the promised stream before validation.
✅ All tests passed ✅Test SummaryBuild PR / linux-x86_64-java25 build > Netty/Handler/Ssl/Ocsp
Build PR / linux-x86_64-java26 build > Netty/Handler/Ssl/Ocsp
🏷️ Commit: 4ae336a Test FailuresOcspServerCertificateValidatorTest (Netty/Handler/Ssl/Ocsp in Build PR / linux-x86_64-java25 build | Attempt 1/2)OcspServerCertificateValidatorTest (Netty/Handler/Ssl/Ocsp in Build PR / linux-x86_64-java26 build | Attempt 1/2)Learn more about TestLens at testlens.app/docs. |
bryce-anderson
approved these changes
Sep 18, 2026
Contributor
|
Auto-port PR for 5.0: #17562 |
Contributor
|
Auto-port PR for 4.1: #17563 |
normanmaurer
added a commit
that referenced
this pull request
Sep 21, 2026
…est verifier (#17562) Auto-port of #17495 to 5.0 Cherry-picked commit: 8488ebd --- Motivation: In DefaultHttp2ConnectionDecoder.onPushPromiseRead(), the promised stream was only reserved via reservePushStream() after the Http2PromisedRequestVerifier checks (isAuthoritative/isCacheable/ isSafe) passed. If the verifier rejected the promised request, the method threw before the stream was ever reserved, so the connection lost all bookkeeping of that stream ID's existence. Modification: - Move the reservePushStream() call ahead of the verifier checks in onPushPromiseRead(), so the promised stream is reserved as soon as the parent stream state is validated, and any subsequent verifier rejection fails an already-reserved stream instead of leaving no record of it. - Add a unit test that rejects a push promise via a custom verifier and asserts the stream was still reserved. Result: The promised stream ID's existence is always tracked once a PUSH_PROMISE is otherwise valid enough to reach verification. Co-authored-by: Norman Maurer <[email protected]>
normanmaurer
added a commit
that referenced
this pull request
Sep 21, 2026
…est verifier (#17563) Auto-port of #17495 to 4.1 Cherry-picked commit: 8488ebd --- Motivation: In DefaultHttp2ConnectionDecoder.onPushPromiseRead(), the promised stream was only reserved via reservePushStream() after the Http2PromisedRequestVerifier checks (isAuthoritative/isCacheable/ isSafe) passed. If the verifier rejected the promised request, the method threw before the stream was ever reserved, so the connection lost all bookkeeping of that stream ID's existence. Modification: - Move the reservePushStream() call ahead of the verifier checks in onPushPromiseRead(), so the promised stream is reserved as soon as the parent stream state is validated, and any subsequent verifier rejection fails an already-reserved stream instead of leaving no record of it. - Add a unit test that rejects a push promise via a custom verifier and asserts the stream was still reserved. Result: The promised stream ID's existence is always tracked once a PUSH_PROMISE is otherwise valid enough to reach verification. Co-authored-by: Norman Maurer <[email protected]>
lltopk
pushed a commit
to lltopk/netty
that referenced
this pull request
Oct 24, 2026
…est verifier (netty#17563) Auto-port of netty#17495 to 4.1 Cherry-picked commit: 8488ebd --- Motivation: In DefaultHttp2ConnectionDecoder.onPushPromiseRead(), the promised stream was only reserved via reservePushStream() after the Http2PromisedRequestVerifier checks (isAuthoritative/isCacheable/ isSafe) passed. If the verifier rejected the promised request, the method threw before the stream was ever reserved, so the connection lost all bookkeeping of that stream ID's existence. Modification: - Move the reservePushStream() call ahead of the verifier checks in onPushPromiseRead(), so the promised stream is reserved as soon as the parent stream state is validated, and any subsequent verifier rejection fails an already-reserved stream instead of leaving no record of it. - Add a unit test that rejects a push promise via a custom verifier and asserts the stream was still reserved. Result: The promised stream ID's existence is always tracked once a PUSH_PROMISE is otherwise valid enough to reach verification. Co-authored-by: Norman Maurer <[email protected]>
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.
Motivation:
In DefaultHttp2ConnectionDecoder.onPushPromiseRead(), the promised
stream was only reserved via reservePushStream() after the
Http2PromisedRequestVerifier checks (isAuthoritative/isCacheable/
isSafe) passed. If the verifier rejected the promised request, the
method threw before the stream was ever reserved, so the connection
lost all bookkeeping of that stream ID's existence.
Modification:
onPushPromiseRead(), so the promised stream is reserved as soon as
the parent stream state is validated, and any subsequent verifier
rejection fails an already-reserved stream instead of leaving no
record of it.
and asserts the stream was still reserved.
Result:
The promised stream ID's existence is always tracked once a
PUSH_PROMISE is otherwise valid enough to reach verification.