Skip to content

test: cover successive HTTP/2 stream limit increases - #1592

Open
He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:test/http2-successive-stream-limit
Open

He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:test/http2-successive-stream-limit

Conversation

@He-Pin

@He-Pin He-Pin commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Motivation

With three ordinary requests queued and only one HTTP/2 stream allowed, each increase in the peer's stream limit should let exactly one more request through. The existing test covered one settings increase with just one request queued.

Modification

Add a client-stack test using the existing frame probes and a fused buffer. Observe all three GETs before the buffer, then count admissions after it. Start at SETTINGS_MAX_CONCURRENT_STREAMS = 1 and raise the peer's limit to 2 and 3. Check the method and exact path on streams 1, 3 and 5. At each limit, acknowledge a separate empty SETTINGS frame that leaves the limit unchanged, then assert that the admitted count matches that limit. Keep the three streams open until the last increase, then complete them with 200 responses in reverse stream order and check graceful completion.

Result

The test covers successive admissions without closing an existing stream to free capacity. No production code or API changes.

Tests

  • JDK 17: the focused Http2ClientSpec test passed 1/1 on both Scala 2.13.18 and 3.3.9. No full CI run was performed locally.
  • http2-tests/Test/scalafmt, http2-tests/Test/scalafmtCheck and git diff --check passed.

References

Motivation:
Exercise each limit increase with multiple ordinary requests queued, without depending on how long the network probe waits.

Modification:
Observe requests before and after the fused bounded queue. At each limit check the next GET and use a separate no-change SETTINGS acknowledgement and the request count to check immediate application admission. Finish all streams in reverse order.

Result:
The test detects an extra admitted request in the ordinary fused client stack without wall-clock silence assertions. Production code is unchanged.
@He-Pin
He-Pin force-pushed the test/http2-successive-stream-limit branch from 8480fce to 64e8acf Compare November 26, 2026 08:41
@He-Pin
He-Pin requested a review from pjfanning November 26, 2026 08:52

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good — the counter after the buffer does catch over-admission, which the existing 2→4 test can't. Nits:

  • Await.result(allOffered.future, remainingOrDefault) plus an AtomicInteger is heavier than the neighbouring inAssertAllStagesStopped(new TestSetup ...) style tests.
  • network.toNet.cancel() in the finally after expectGracefulCompletion() looks redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants