Why Does HTTP/2 Flow Control Fail in Alibaba Cloud PTS? A Deep Dive
This article explains the background of Alibaba Cloud's Performance Testing Service (PTS), details HTTP/2 flow‑control mechanisms, analyzes a bug where WINDOW_UPDATE frames caused a window size overflow, shows how the issue was diagnosed and fixed, and provides reference resources.
Background
Customer reported HTTP/2 errors in Alibaba Cloud Performance Testing Service (PTS) after PTS added HTTP/2 support (via httpclient5) in May 2021. The client consistently received errors when testing an HTTP/2‑enabled domain.
HTTP/2 Flow Control
HTTP/2 introduces application‑layer flow control using WINDOW_UPDATE frames. Flow control is applied per‑stream and per‑connection, not end‑to‑end, and cannot be disabled. The default window size is 65 535 bytes; the maximum allowed size is 2³²‑1.
Key frame types:
DATA : carries request/response payload.
HEADERS : creates a new stream with associated headers.
PRIORITY : sets stream priority.
RST_STREAM : abruptly terminates a stream.
SETTINGS : negotiates connection parameters.
PUSH_PROMISE : server‑initiated push.
PING : health check.
GOAWAY : signals connection shutdown.
WINDOW_UPDATE : updates flow‑control window size.
CONTINUATION : continues large header blocks.
During connection establishment, SETTINGS frames set initial window sizes (e.g., SETTINGS_INITIAL_WINDOW_SIZE defaults to 65 535). As DATA frames are sent, the window shrinks; receiving a WINDOW_UPDATE frame enlarges it again.
Problem Diagnosis
Using the URL https://www.sysgeek.cn/ as a test case, local debugging showed that after receiving a WINDOW_UPDATE frame the client attempted to set the connection window size to a value larger than 2³²‑1, triggering an exception.
The observed window size was 524 288 bytes, far above the default 65 535. Inspection of the source revealed that the httpcore5 implementation incorrectly modified the connection window size while processing a SETTINGS frame, contradicting RFC 7540 §6.9.2, which states that the connection window may only change after a WINDOW_UPDATE frame.
Removing the offending line in httpcore5 allowed requests to succeed. The bug was later fixed in a subsequent commit.
References
PTS documentation: https://help.aliyun.com/document_detail/145501.html
RFC 7540 (HTTP/2) – Section 6.9.2: https://datatracker.ietf.org/doc/html/rfc7540#section-6.9.2
Additional reading – Section 5.2: https://datatracker.ietf.org/doc/html/rfc7540#section-5.2
In‑depth overview: https://undertow.io/blog/2015/04/27/An-in-depth-overview-of-HTTP2.html
Flow‑control notes: https://laike9m.com/blog/rfc7540-bi-ji-wu-flow-control,106/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
