Skip to content

add support for eventlets _AlreadyHandled object - #1406

Merged
benoitc merged 5 commits into
benoitc:masterfrom
stefaang:master
Dec 21, 2016
Merged

benoitc merged 5 commits into
benoitc:masterfrom
stefaang:master

Conversation

@stefaang

@stefaang stefaang commented Dec 6, 2016

Copy link
Copy Markdown
Contributor

fixes #1210

@Hum4n01d

Hum4n01d commented Dec 7, 2016

Copy link
Copy Markdown

Does this just silence the error?

@benoitc

benoitc commented Dec 7, 2016 via email

Copy link
Copy Markdown
Owner

@stefaang

stefaang commented Dec 7, 2016

Copy link
Copy Markdown
Contributor Author

@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

Hum4n01d commented Dec 7, 2016

Copy link
Copy Markdown

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

@benoitc

benoitc commented Dec 10, 2016

Copy link
Copy Markdown
Owner

@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
Copy Markdown
Contributor Author

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

@Hum4n01d

Copy link
Copy Markdown

So can it be merged?

@tilgovi

tilgovi commented Dec 21, 2016

Copy link
Copy Markdown
Collaborator

This looks good to me.

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

benoitc commented Dec 21, 2016

Copy link
Copy Markdown
Owner

merged. Thanks!

@Hum4n01d

Copy link
Copy Markdown

Yay! Now my logs won't be clogged up

@qwexvf

qwexvf commented Dec 22, 2016

Copy link
Copy Markdown

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