Skip to content

Commit a39851e

Browse files
committed
Fix connection-level window mismatch causing 408/504 timeouts
1 parent af0142c commit a39851e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

proxy/http2/Http2ConnectionState.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ rcv_data_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
9393

9494
Http2StreamDebug(cstate.session, id, "Received DATA frame");
9595

96+
// Update connection window size, before any stream specific handling
97+
cstate.decrement_server_rwnd(payload_length);
98+
9699
if (cstate.get_zombie_event()) {
97100
Warning("Data frame for zombied session %" PRId64, cstate.session->get_connection_id());
98101
}
@@ -162,7 +165,8 @@ rcv_data_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
162165
}
163166

164167
// Check whether Window Size is acceptable
165-
if (!cstate.server_rwnd_is_shrinking && cstate.server_rwnd() < payload_length) {
168+
// compare to 0 because we already decreased the connection rwnd with payload_length
169+
if (!cstate.server_rwnd_is_shrinking && cstate.server_rwnd() < 0) {
166170
return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, Http2ErrorCode::HTTP2_ERROR_FLOW_CONTROL_ERROR,
167171
"recv data cstate.server_rwnd < payload_length");
168172
}
@@ -171,8 +175,7 @@ rcv_data_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
171175
"recv data stream->server_rwnd < payload_length");
172176
}
173177

174-
// Update Window size
175-
cstate.decrement_server_rwnd(payload_length);
178+
// Update stream window size
176179
stream->decrement_server_rwnd(payload_length);
177180

178181
if (is_debug_tag_set("http2_con")) {

0 commit comments

Comments
 (0)