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
Timeout exception after greenlet.switch with gevent worker on gunicorn newer than 0.15 #880
Comments
do you have a way to reproduce it? |
Thank you for your reply. I have it on our production servers. Will try to produce a local example of this error. |
thanks! |
Hey @benoitc Please tell me is it the correct fix and why it's working :) Because there should've been some reason why this line was removed in 0.16. |
Any update on this one? |
I didn't have time to check it ye sorry :/ I will have a look on it later in the day |
any update on this? I'm also getting this exception with gunicorn 18.0 |
@stefanfoulis i wil make sure to test that tomorrow, for the new release coming on friday. |
@benoitc ping? :) Any updates? |
That might be an appropriate change. It explains the issue but it's worth discussing the solution. ggevent.py doesn't set a timeout on the socket, but puts it in blocking mode because that's how gevent is meant to act. Reading the next request off the wire takes longer than the socket timeout but less time than the keep-alive timeout, which is the Since the default keep-alive timeout is two seconds and the default worker timeout is thirty seconds (or, at least, A < B) the patch submitted by @w0rse works. The gevent worker aborts the request parsing and returns It's also curious why the default for the socket is not a timeout of The worker timeout is probably not the right timeout to set on the client socket for async. It's a worker non-responsive timeout for gunicorn to kill dead processes, not really a request timeout, though it serves this purpose on the sync worker. The patch could be changed to set a different value, but I'm not sure what it should be. Maybe we could introduce one. @benoitc @berkerpeksag does that all sound right to you? |
I'm not that familiar with the gevent worker, but SGTM. |
@ochronus you could check what |
I'm working with @pierrei, and setting |
I have the same problem, but my gevent version is 1.1.2, and gunicorn 19.3.0. |
closed by #1616 |
Hello, gunicorn!
We are seeing a lot of the following errors after upgrading gunicorn to the latest version:
2014-09-10 03:19:12 [3367] [ERROR] Socket error processing request.
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/gunicorn/workers/async.py", line 42, in handle
req = six.next(parser)
File "/usr/lib/python2.6/site-packages/gunicorn/http/parser.py", line 39, in next
self.mesg = self.mesg_class(self.cfg, self.unreader, self.req_count)
File "/usr/lib/python2.6/site-packages/gunicorn/http/message.py", line 151, in init
super(Request, self).init(cfg, unreader)
File "/usr/lib/python2.6/site-packages/gunicorn/http/message.py", line 48, in init
unused = self.parse(self.unreader)
File "/usr/lib/python2.6/site-packages/gunicorn/http/message.py", line 164, in parse
self.get_data(unreader, buf, stop=True)
File "/usr/lib/python2.6/site-packages/gunicorn/http/message.py", line 155, in get_data
data = unreader.read()
File "/usr/lib/python2.6/site-packages/gunicorn/http/unreader.py", line 37, in read
d = self.chunk()
File "/usr/lib/python2.6/site-packages/gunicorn/http/unreader.py", line 63, in chunk
return self.sock.recv(self.mxchunk)
File "/usr/lib64/python2.6/site-packages/gevent/socket.py", line 392, in recv
self._wait(self._read_event)
File "/usr/lib64/python2.6/site-packages/gevent/socket.py", line 298, in _wait
self.hub.wait(watcher)
File "/usr/lib64/python2.6/site-packages/gevent/hub.py", line 341, in wait
result = waiter.get()
File "/usr/lib64/python2.6/site-packages/gevent/hub.py", line 568, in get
return self.hub.switch()
File "/usr/lib64/python2.6/site-packages/gevent/hub.py", line 331, in switch
return greenlet.switch(self)
timeout: timed out
Further tests revealed that the same code produces that errors on any version of gunicorn newer than 0.15. Is there anything we can do to fight this behavior? We use gevent workers version 1.0.1 and gunicorn is behind a proxy with keepalive enabled.
The text was updated successfully, but these errors were encountered: