fix(http2): wait when outbound flow control window is negative#1095
Open
l46983284-cpu wants to merge 2 commits into
Open
fix(http2): wait when outbound flow control window is negative#1095l46983284-cpu wants to merge 2 commits into
l46983284-cpu wants to merge 2 commits into
Conversation
h2 can report a negative local flow-control window after DATA has already
been accounted. `_wait_for_outgoing_flow` only blocked on `flow == 0`, so a
negative window was returned as max_flow and `send_data` raised
LocalProtocolError ("Cannot send N bytes, flow control window is -M").
Treat any non-positive flow like zero and wait for WINDOW_UPDATE credit.
Fixes encode#1082
Signed-off-by: Alex Chen <l46983284@gmail.com>
CI mypy reported unused-ignore on method-assign comments in the encode#1082 regression. Use setattr for the temporary monkeypatches instead. Signed-off-by: Alex Chen <l46983284@gmail.com>
Author
CI residualRoot cause was PR-caused style/type, not the product wait fix:
Fix: drop the unused ignores and monkeypatch via |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HTTP/2 request bodies could fail with
LocalProtocolError: Cannot send N bytes, flow control window is -Mwhen h2 reported a negative local flow-control window._wait_for_outgoing_flowonly waited whileflow == 0, so negative windows were returned asmax_flowandsend_dataraised.This change waits on any non-positive flow (same as zero) until
WINDOW_UPDATEcredit is available.Test plan
tests/_sync/test_http2.py::test_http2_wait_for_outgoing_flow_handles_negative_windowtests/_async/test_http2.py::test_http2_wait_for_outgoing_flow_handles_negative_windowtest_http2_connection_with_flow_controlFixes #1082