Skip to content

Conversation

@oallenj
Copy link

@oallenj oallenj commented Sep 30, 2024

Fixes #3301.

The problem is that if the request body is not read and the gthread worker finishes handling a request with a large request body, it will see that the socket is still readable and call on_client_socket_readable. However, the readable bytes are just the rest of the request body. The part of the code annotated "Discard any unread body of the previous message" will discard that request body, but gthread will then proceed to subsequently try and read a full HTTP request, which may have not been sent. This change will discard the request body after handling a request, and before on_client_socket_readable can be called so this doesn't happen.

I'm not sure how to make a test for this because it requires multiple connections and doesn't seem to fit in with the rest of gunicorn's test suite.

@oallenj oallenj force-pushed the 3301-request-body-handling branch from dde5abe to 461e87f Compare September 30, 2024 13:54
@benoitc benoitc self-assigned this Oct 12, 2024
@oallenj oallenj force-pushed the 3301-request-body-handling branch from 461e87f to 8c41618 Compare February 13, 2025 13:28
@somerobmitchell
Copy link

@benoitc Do you have any update on the review of this PR?

Issue is here: #3301

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.

gthread worker will block

3 participants