-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
'Response' object has no attribute 'status_code' in wsgi.py with websockets #1210
Comments
@bclark8923 do you have any application that could help to reproduce the issue? |
Yup! What would you like me to do? On Monday, March 28, 2016, Benoit Chesneau [email protected] wrote:
Thanks, Get to know me on Facebook https://facebook.com/bclark8923 & Twitter |
@bclark8923 if it can be streamed so eventually i could include some part in a test that would help :) Also which version of gunicorn are you using? |
Yes please! Email me [email protected] and 19.x of some sort can check On Monday, March 28, 2016, Benoit Chesneau [email protected] wrote:
Thanks, Get to know me on Facebook https://facebook.com/bclark8923 & Twitter |
Using version 19.4.5 |
I'm having the same issue. I'm using gunicorn version 18.0. Any fix available already? |
if anyone have z code to reproduce it thatt would help :) |
@benoitc - That makes sense.. ;-) I'll fix something up next week and let you know! |
@benoitc - Alright, I fixed something up before the weekend after all. You can find the repo with instructions in the readme here: https://github.com/kramer65/gunicorn-error btw: I'm using gunicorn version 18.0 |
Probably something needs to return |
Both of the examples in the "examples/websocket" directory return this constant from their WSGI handler. |
@benoitc - Does the example to reproduce the error help you with finding the error? Can I be of any other assistance to help this be resolved? |
@kramer65 yes I reproduced the error. So Gunicorn is a pure WSGI engine and is expecting a WSGI response containing a status: (related to this code: https://github.com/benoitc/gunicorn/blob/master/gunicorn/workers/async.py#L103-L119) As @tilgovi said you can bypass the response handling from gunicorn by returning ALREADY_HANDLED As far as I read the code of flash socketio it is wrapping the flask application in which return the wsgi application or their own own handler if it find the path: So it return which itself return At this point it appears that neither And then an error may happen here: since it can return a response without having set a status or anything. I can see that the upgrade use the same websocket object as in our example: I think that instead of returning the final It should probably return Just a guess anyway since that code is quite difficult to read. Hopefully it will helps. |
@kramer65 let me know about the status of this ticket for you anyway :) |
@benoitc the The Gunicorn should (I think) recognize eventlet's |
It's great if you can fix this issue. I'm running |
I am experiencing similar problems, and was wondering if there is any news on this issue? |
@benoitc - Do you think the suggestion as made by @miguelgrinberg above (to let Gunicorn recognize eventlet's ALREADY_HANDLED constant in addition to its own and handle it in the same way) is a good idea? |
@kramer65 if you can find a way to cleanly add support for that, I think it makes sense for the eventlet worker to handle it. Right now the logic to handle this is a bit buried inside |
@tilgovi - It has been a while since you send me your message, but I wanted to respond to this after all. The problem is that I kinda hit my limit in what I can do for this. I really have no clue how to proceed to solve this. In the meantime my logs are filled with error messages like the one below, so I do have every reason to put some energy in having this solved. I just don't fully understand what the exact cause of the problem is, let alone that I understand how I could solve this. If anybody wants to get into contact I would be happy to discuss the issue, and then I might be able to be of a bit more help than I am now.
|
did one fixed it ?..... |
@qwexvf - Unfortunately I didn't. My logs are still filling up with errors. :-( Anybody else? |
@kramer65 i see. i've been waiting this for ages, if anyone has the fix please share with us! thanks! |
any updates? |
I'm sure there are cleaner ways to fix this, but at least it's a start. |
@stefaang thanks im gonna try thought it! |
When will the fix for this be released on PyPI? |
tomorrow
…On Fri, 17 Feb 2017 at 16:46, Eddie ***@***.***> wrote:
When will the fix for this be released on PyPI?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1210 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAA4ogTRMF7EfR25G6gLrktOdh_iA4Ciks5rdcDYgaJpZM4HbcdP>
.
|
Has it been released? |
@benoitc any word on the update being pushed to pypi? |
@defionscode i will make a release in on thursday morning (tomorrow). |
Excellent, thank you
…On Wed, Feb 22, 2017 at 11:54 AM Benoit Chesneau ***@***.***> wrote:
@defionscode <https://github.com/defionscode> i will make a release in on
thursday morning (tomorrow).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1210 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEcrYp6QfVpWXhG14f4M-lPDHMn0cFncks5rfGhWgaJpZM4HbcdP>
.
|
Has this fix been released? |
@Decker108 status is tracked by #1471 . It will be released today... |
This bug is still happening on my side with the latest version 19 and 20 of gunicorn. Was it supposed to be fixed @benoitc ? |
Please re-open. This bug is still very much active, even with |
Re-opened and assigned to me. |
A new protocol, such as WebSockets or HTTP/2, may manage the framing of multiple messages or requests of that protocol over a single connection. - Close connections after completion of any upgraded response. - Close connections after a response with status code less than 200. Any such response should be only for a protocol upgrade since applications never see any `Expect` header. - Ensure that the `status_code` member always exists on instances of the `Response` class (close #1210).
A new protocol, such as WebSockets or HTTP/2, may manage the framing of multiple messages or requests of that protocol over a single connection. Once the WSGI callable returns, the connection should close. - Close connections after completion of any upgraded response. - Close connections after a response with status code less than 200. Any such response should be only for a protocol upgrade since applications never see any `Expect` header. - Ensure that the `status_code` member always exists on instances of the `Response` class (close #1210).
A new protocol, such as WebSockets or HTTP/2, may manage the framing of multiple messages or requests of that protocol over a single connection, but the connection should close once the WSGI callable returns. - Close connections after completion of any upgraded response. - Close connections after a response with status code less than 200. Any such response should be only for a protocol upgrade since applications never see any `Expect` header. - Ensure that the `status_code` member always exists on instances of the `Response` class (close #1210).
A new protocol, such as WebSockets or HTTP/2, may manage the framing of multiple messages or requests of that protocol over a single connection, but the connection should close once the WSGI callable returns. - Close connections after completion of any upgraded response. - Close connections after a response with status code less than 200. Any such response should be only for a protocol upgrade since applications never see any `Expect` header. - Ensure that the `status_code` member always exists on instances of the `Response` class (close #1210).
I think this could happen if the application raises an exception when handling a request before it starts a response. Gunicorn tries to figure out if the response was started and the headers should be sent but the status code is not defined yet. I believe I've fixed this issue in #3126 while fixing an unrelated issue with protocol upgrades (e.g. WebSockets). |
I start my app using
gunicorn --worker-class eventlet -w 1 server:app --bind="127.0.0.1:5000"
And when using Flack-SocketIO for websockets I often get an error with Gunicorn not returning from a function properly
Any advice on configurations I could use to fix this or is it a bug?
The text was updated successfully, but these errors were encountered: