Skip to content

Pause HTTP/2 relay output when a send buffer is full - #1770

Closed
essen wants to merge 2 commits into
masterfrom
h2-relay-pause
Closed

essen wants to merge 2 commits into
masterfrom
h2-relay-pause

Conversation

@essen

@essen essen commented Dec 2, 2026

Copy link
Copy Markdown
Member

The session receives one pause when the stream or connection buffer reaches its max, and one unpause when both are back under. Sends stay fire-and-forget until then.

@essen
essen requested a review from grok-99s December 2, 2026 11:33
Comment thread src/cowboy_http2.erl Resolved
Comment thread test/ws_handler_SUITE.erl Resolved
@essen
essen requested a review from grok-99s December 2, 2026 12:18
Comment thread test/ws_handler_SUITE.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
@essen
essen requested a review from grok-99s December 3, 2026 11:29
@essen
essen requested a review from grok-99s December 3, 2026 12:10
@essen
essen requested a review from grok-99s December 3, 2026 13:43
Comment thread src/cowboy_websocket.erl Resolved
Comment thread test/ws_handler_SUITE.erl Resolved
@essen
essen requested a review from grok-99s December 3, 2026 17:57
Comment thread test/ws_handler_SUITE.erl Resolved
Comment thread src/cowboy_stream.erl Resolved
@essen
essen requested a review from grok-99s December 3, 2026 19:49
Comment thread test/ws_handler_SUITE.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
@essen

essen commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

We accept that the timeout error will result in HTTP/2 internal_error.

@essen
essen requested a review from grok-99s December 4, 2026 09:13
Comment thread test/ws_handler_SUITE.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
Comment thread src/cowboy_http2.erl Resolved
Comment thread test/http2_SUITE.erl Resolved
A reset, a peer RST_STREAM, or a rejected header list can drop
the connection buffer under its max without a send, so the
usual alarm does not run. Streams still at or over their own
max stay blocked.
@essen
essen force-pushed the h2-relay-pause branch 2 times, most recently from 92781e7 to 9a7bdbc Compare December 4, 2026 11:55
Comment thread test/http2_SUITE.erl Resolved
Comment thread test/ws_handler_SUITE.erl Resolved
Comment thread test/ws_handler_SUITE.erl Resolved
Comment thread test/ws_handler_SUITE.erl Resolved
@essen
essen force-pushed the h2-relay-pause branch 2 times, most recently from 609c19d to 9cdf8f4 Compare December 4, 2026 12:53
@essen
essen requested a review from grok-99s December 4, 2026 13:01
Comment thread test/http2_SUITE.erl Resolved
The websocket waits in transport_send for one ack per payload.
HTTP/2 queues the data and acks when both the stream and
connection buffers are under their max. While either buffer
is at or over its max the ack is withheld. An alarm off
releases it once both are back under. A finished stream
counts as under. HTTP/3 acks once the QUIC stack accepts
the payload. The wait returns {error, timeout} after 30s
and the process exits {shutdown, timeout}, which becomes
internal_error. An automatic pong terminates if its send fails.
@essen

essen commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Merged!

@essen essen closed this Dec 4, 2026
@essen
essen deleted the h2-relay-pause branch December 4, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants