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

Fixes write_error loop from bail_out function #309

Merged
merged 1 commit into from
Jan 18, 2017

Conversation

seemethere
Copy link
Member

Fixes stack-overflow found in #307

@seemethere seemethere requested a review from r0fls January 18, 2017 00:29
if self.transport.is_closing():
log.error(
"Connection closed before error was sent to user @ {}".format(
self.transport.get_extra_info('peername')))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use the property hereself.request.ip

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well in the example that we had seen from the issue self.parser was still None so I'd be wary of if self.request was filled out correctly as well. It's just a safe way of doing it.

@r0fls
Copy link
Contributor

r0fls commented Jan 18, 2017

@seemethere I was going to use another try/except here, and just log in the exception, instead of trying to write. Are there any other exceptions that could occur during self_write within bail_out and lead to a circular exception? If there are, the try/except makes more sense imo.

@r0fls
Copy link
Contributor

r0fls commented Jan 18, 2017

I would also think a try/except would be faster than checking the transport.is_closing() method each time, but I don't have a working test case for this. The issue didn't actually throw any exception for me ... maybe I did something wrong.

@seemethere
Copy link
Member Author

You might need to run it through wrk to replicate the issue.

@r0fls r0fls merged commit 5a6fb67 into sanic-org:master Jan 18, 2017
@r0fls
Copy link
Contributor

r0fls commented Jan 18, 2017

I saw almost no benefit to using try/except instead, so let's use this for now.

@M31N99
Copy link

M31N99 commented Jan 18, 2017

241

@seemethere seemethere added this to the 0.3.0 milestone Jan 18, 2017
@seemethere seemethere deleted the fix_write_error_loop branch January 28, 2017 01:39
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.

None yet

3 participants