[Bug] HTTP/2 ASGI body duplication - request body delivered twice via receive()
#3558
Closed
benleembruggen
started this conversation in
Issue Triage
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
When using HTTP/2 with an ASGI worker, the request body is delivered to the application twice, resulting in corrupted/doubled request bodies. HTTP/1.1 over TLS on the same endpoint works correctly.
Steps to Reproduce (for bugs)
Configuration
No response
Logs / Error Output
No response
Gunicorn Version
gunicorn 25.2.0
Python Version
Python 3.12.0
Worker Class
asgi (beta)
Operating System
macOS 15.7.4
Additional Context
Root cause
HTTP2Stream.receive_data() (stream.py:129) writes every DATA frame to both stores:
The receive() closure in _handle_http2_request() (protocol.py:1297) has two read paths:
Sequence:
Proposed fix
Set
body_received = Truein Path B when the body is complete, preventing Path A from firing:Checklist
All reactions