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

add support for eventlets _AlreadyHandled object #1406

Merged
merged 5 commits into from
Dec 21, 2016
Merged

add support for eventlets _AlreadyHandled object #1406

merged 5 commits into from
Dec 21, 2016

Conversation

stefaang
Copy link
Contributor

@stefaang stefaang commented Dec 6, 2016

fixes #1210

@Hum4n01d
Copy link

Hum4n01d commented Dec 7, 2016

Does this just silence the error?

@benoitc
Copy link
Owner

benoitc commented Dec 7, 2016 via email

@stefaang
Copy link
Contributor Author

stefaang commented Dec 7, 2016

@Hum4n01d The error was caused by an empty wsgi response on disconnect, due to a slightly different implementation of the _AlreadyHandled object. The goal of _AlreadyHandled is to raise a StopIteration exception to close the socket.
@benoitc I reworked this into a wrapper around self.wsgi by overloading self.load_wsgi in the geventlet worker.
I'm not that familiar with the all the eventing projects... but this error was messing up my logs so I wanted a quick fix.

@Hum4n01d
Copy link

Hum4n01d commented Dec 7, 2016

I don't totally get what you're saying but please merge it @benoitc

@benoitc
Copy link
Owner

benoitc commented Dec 10, 2016

@stefaang the change can be simpler imo,

so we check ALREADY_HANDLED there:
https://github.com/benoitc/gunicorn/blob/master/gunicorn/workers/async.py#L104

Instead we could check it using a function is_already_handled that could be overriden by the worker. In the case of Eventlet it would check for both the gunicorn value and the eventlet value. Do you want to make the change?

@stefaang
Copy link
Contributor Author

You're right, that's a better approach. I'll get around with another fix.

@Hum4n01d
Copy link

So can it be merged?

@tilgovi
Copy link
Collaborator

tilgovi commented Dec 21, 2016

This looks good to me.

@benoitc benoitc merged commit 9430742 into benoitc:master Dec 21, 2016
@benoitc
Copy link
Owner

benoitc commented Dec 21, 2016

merged. Thanks!

@Hum4n01d
Copy link

Yay! Now my logs won't be clogged up

@qwexvf
Copy link

qwexvf commented Dec 22, 2016

Thank you for this fix <3

mjjbell pushed a commit to mjjbell/gunicorn that referenced this pull request Mar 16, 2018
add support for eventlets _AlreadyHandled - issue 1210 - Response object has no attribute status_code
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.

'Response' object has no attribute 'status_code' in wsgi.py with websockets
5 participants