Skip to content

Preserve receive windows when local increments overflow - #1350

Open
FFspiky wants to merge 1 commit into
python-hyper:masterfrom
FFspiky:fix/atomic-local-window-overflow
Open

FFspiky wants to merge 1 commit into
python-hyper:masterfrom
FFspiky:fix/atomic-local-window-overflow

Conversation

@FFspiky

@FFspiky FFspiky commented Nov 11, 2026

Copy link
Copy Markdown

increment_flow_control_window() raises FlowControlError when a local increment would exceed 2**31 - 1, but the window manager has already stored the overflowing value. No WINDOW_UPDATE is sent, so local credit diverges from the peer and subsequent valid increments fail.

Validate the proposed size before assigning it. Four regressions cover connection and stream windows, pending PING output, consumed/acknowledged data, a valid increment after rejection, and the exact maximum boundary. They verify that rejected updates preserve current credit, the replenishment maximum, processed-byte accounting and queued bytes.

Validation on macOS arm64 / Python 3.12.14:

  • All four regressions fail before the fix; 1,688 tests pass afterward with 100% statement and branch coverage.
  • Source Ruff, strict-bytes mypy, strict Sphinx HTML and whitespace checks pass. The modified test module has eight pre-existing Ruff diagnostics and no new ones.
  • The full Python matrix and h2spec were not run locally.

This revisits the defect described by adenzhou1350 in withdrawn PR #1335. The implementation and tests were derived from current upstream source after reproducing it. It is separate from #1349 and does not alter handling of invalid updates received from a peer.

AI assistance: OpenAI Codex implemented the change, ran validation and drafted this description.

Validate the proposed window size before assigning it, so a rejected local
increment cannot corrupt connection or stream receive credit.

Exercise both paths with empty and nonempty wire buffers, distinct current
and maximum windows, pending processed bytes, a subsequent valid increment,
and the exact maximum boundary.

The same defect was previously proposed in withdrawn PR python-hyper#1335. This change
was reproduced and derived from current upstream source; that patch was
not fetched, applied, or cherry-picked.

Related-to: python-hyper#1335
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