[Bug] HTTP/2 body duplication fix in #3559 is incomplete — _body_complete never set in normal h2 flow #3567
benleembruggen
started this conversation in
Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Type
Bug Report
Description
Summary
PR #3559 (shipped in 25.3.0) added a guard in the
receive()closure's streaming path to setbody_received = Truewhenstream._body_completeisTrue. This was intended to prevent the fast path from re-reading already-consumed data from BytesIO, which caused HTTP/2 request bodies to be doubled.However,
_body_completeis never set toTruein the normal HTTP/2 event flow, so the guard never fires and the body duplication still occurs.Root Cause
In
gunicorn/http2/connection.py, the h2 "end of stream" signal is handled by_handle_stream_ended(), which sets:But it does not set:
Meanwhile, _handle_data_received() always calls stream.receive_data(data, end_stream=False) — so _body_complete is never set from the data path either.
Steps to Reproduce (for bugs)
Configuration
No response
Logs / Error Output
No response
Gunicorn Version
25.3.0
Python Version
3.12
Worker Class
asgi (beta)
Operating System
macOS 15.7.4
Additional Context
No response
Checklist
Beta Was this translation helpful? Give feedback.
All reactions