Skip to content

fix: hold HTTP/2 client requests until peer stream capacity returns - #1673

Open
He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:fix/http2-park-client-request-until-stream-capacity
Open

He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:fix/http2-park-client-request-until-stream-capacity

Conversation

@He-Pin

@He-Pin He-Pin commented Nov 26, 2026

Copy link
Copy Markdown
Member

Motivation

A client can already have requested the next application request when a peer lowers its HTTP/2 stream concurrency limit. Starting that request after acknowledging the new limit can exceed the capacity the peer allows.

Modification

Recheck capacity at admission and hold at most one already-pulled request. Resume it after the relevant SETTINGS acknowledgement or when a stream slot becomes available. If the connection closes before the request can start, cancel its streamed request body. Preserve the existing backpressure and completion timeout, and document those semantics.

Result

Requests start only when current peer capacity allows. The pending request body is cleaned up if it cannot be sent. The public HTTP/2 builder tests cover both resumption and cleanup.

Tests

  • JDK 17 with Scala 2.13.18 and 3.3.9: seven focused tests passed on each version, using the exact changed sources compiled with existing support classes.
  • Verified the two regression scenarios against the corresponding pre-fix revisions. Scoped formatting and license-header checks passed.
  • A fresh full sbt/Paradox run was not verified: the environment ended the process during setup or compilation.

References

Motivation:
A pending application pull can deliver a request after the peer reduced stream capacity.

Modification:
Hold at most one pulled request and resume it after a successful SETTINGS acknowledgement or when a stream slot opens. Preserve ACK ordering for newly unblocked DATA. Cancel an unsent streamed entity if the connection closes.

Result:
The client waits for capacity, keeps existing backpressure and shutdown semantics, and releases the unsent body on close. The acknowledgement order from apache#1594 is preserved.

References:
RFC 9113 Sections 5.1.2, 6.5.2, and 6.5.3; Apache Pekko HTTP apache#1592, apache#1594, and apache#1611.
@He-Pin
He-Pin force-pushed the fix/http2-park-client-request-until-stream-capacity branch from 1b0b6a4 to e4c56bd Compare November 26, 2026 20:25
@He-Pin
He-Pin requested a review from pjfanning November 26, 2026 23:58
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.

1 participant