Skip to content

Raise HTTP/2 receive windows and close TLS conns without waiting - #976

Merged
benoitc merged 1 commit into
masterfrom
fix/h2-recv-window
Oct 23, 2026
Merged

benoitc merged 1 commit into
masterfrom
fix/h2-recv-window

Conversation

@benoitc

@benoitc benoitc commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Large HTTP/2 downloads failed with {stream_error, internal_error} over slow links (for example 41 MB from PeeringDB, fine over HTTP/1.1 and curl). hackney kept the default 64 KB stream and connection windows, so only one window moved per round trip and the server reset the stream at its timeout. hackney now asks for 8 MB per stream and 32 MB for the connection, using the new connection_window_size option in h2 0.12.5. At 250 ms RTT this matches HTTP/1.1.

Pooled TLS connections were also logged as killed by hackney_conn_sup. ssl:close/1 waits for the server to close its side, which takes longer than the pool's 100 ms stop budget. The conn now shuts the socket down before closing it, so it exits normally.

Note: with async once, a single stream can now have up to 8 MB in flight instead of 64 KB.

hackney ran HTTP/2 with the default 64 KB stream and connection windows,
so a large download moved one window per round trip. Over a slow link a
40 MB body outlasted the server's stream timeout and failed with
{stream_error, internal_error}. Use 8 MB per stream and 32 MB for the
connection (h2 0.12.5 connection_window_size).

ssl:close/1 waits for the server to close its side, at least one round
trip, so the pool's 100 ms stop budget killed pooled TLS conns and logged
a supervisor report. Shut the socket down before closing it so the conn
stops at once.
@benoitc
benoitc merged commit 18e1d66 into master Oct 23, 2026
6 checks passed
@benoitc
benoitc deleted the fix/h2-recv-window branch October 23, 2026 20:15
@benoitc benoitc mentioned this pull request Oct 23, 2026
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