-
-
Notifications
You must be signed in to change notification settings - Fork 463
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
OSError: raw readinto() returned invalid length -1 (should have been between 0 and 8192) #368
Comments
I think you've found a bug in the The I believe the I will try to reproduce and fix it. |
So a client disconnects early in the request and server cannot read data, therefore |
That is correct. You can reproduce it by refreshing a browser very quickly, or aborting a |
I see you ignored |
That is a good question. I don't know what other circumstances can result in an The thread is exclusively used to handle an incoming request though, so it's probably fine to ignore any |
i'm hesitant to have such a blunt ignore. should at least check the |
can you reproduce reliably? what happens if you do the same thing to a flask and/or werkzeug hello world? |
I'll try to find a way to reproduce when I have time. |
The problem is with the eventlet WSGI server. You can demonstrate it using Flask with the following, which uses eventlet's own import eventlet
eventlet.monkey_patch()
from eventlet import wsgi
from flask import Flask
app = Flask(__name__)
@app.route('/answer')
def hello_world():
return '42'
wsgi.server(eventlet.listen(('', 5000)), app) The following will trigger the error and you'll see the traceback in the console: import eventlet
eventlet.monkey_patch()
import requests
try:
while True:
gt = eventlet.spawn(requests.get, "http://localhost:5000/answer")
eventlet.sleep(.005)
gt.kill()
except KeyboardInterrupt:
pass The exception doesn't take down the server process though. The thread running Interestingly enough, the |
still investigating. i wonder if it's related to https://bugs.python.org/issue13322 |
nope. just an eventlet bug (codepath only used with py3). working on a patch. not sure what the best fix/workaround is going to be. there's no |
in combination with a slightly unhelpful error message from cpython |
Awesome. What do you want to do while we're waiting for that fix to land? Eventlet's own server blanket swallows everything, which may be why this bug went unnoticed. I'm OK string-matching the error for the time being, although I wonder what the best behaviour is here -- should the nameko process die if the recv thread throws an unhandled exception? That is consistent with our behaviour everywhere else. |
i think our assumption is that an uncaught exceptions could be anything, so the safest thing to do is suicide. in this particular case, it might be possible to somehow attribute this exception to the worker (hm. maybe not, since we might not have parsed enough of the request yet). if we can't, then this is an error on the extension level -> suicide and again, for this particular case, this particular exception (which is due to a bug) will now (once we catch it) no longer bubble out, so no reason to suicide |
OK great. I've reflected these change in #370. There's one outstanding comment there about faking vs triggering the failure. |
make sure `_recv_loop` returns the correct value when `recv_meth` is of foo_into type (fills a buffer and returns number of bytes, not the data) #353 nameko/nameko#368
After running service for a while, this error occurred. Not sure if you can reproduce without incoming requests, but it happens to me every time.
Here's my code
The
client
is something similar to an HTTP client that make requests. And here's error log:So you might think there's some bug in my code, but the service would work normally for hours, receiving requests and returning data without any problem. And suddenly it just crashed.
The text was updated successfully, but these errors were encountered: