Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on_finish() not called after max body size hit #2711

Open
dylanbfox opened this issue Jul 24, 2019 · 3 comments
Open

on_finish() not called after max body size hit #2711

dylanbfox opened this issue Jul 24, 2019 · 3 comments

Comments

@dylanbfox
Copy link

I override self.request.connection.set_max_body_size(XXXXXX) and set it to some value, say 5MB. I also depend on on_finish() to do some cleanup once the request finishes. If the connection is closed with the client because the body size limit is hit, on_finish does not get called.

@ploxiln
Copy link
Contributor

ploxiln commented Jul 24, 2019

I think you could check for missed cleanup in on_connection_close()

I'm not completely sure if the fact that on_finish() may not be called after prepare() is called is a bug ... might this only be possible for @stream_request_body?

@dylanbfox
Copy link
Author

dylanbfox commented Jul 25, 2019

Correct -- this is with @stream_request_body

Is the expected behavior that on_finish() is also not called if the client abruptly closes the connection? I think I'm seeing that as well (also with @stream_request_body)

Update:

Just tested this and on_connection_close() is called if either the server or client close the connection. Thanks for the help!

Is it safe to assume that on_connection_close() and on_finish() won't ever both be called for the same request?

@bdarnell
Copy link
Member

bdarnell commented Aug 2, 2019

Yes, I think that's right. If prepare is called, you'll get exactly one call to either on_connection_close or on_finish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants