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

Eventlet worker raises error: [Errno 9] Bad file descriptor on pypy #602

Closed
sontek opened this issue Aug 27, 2013 · 4 comments
Closed

Eventlet worker raises error: [Errno 9] Bad file descriptor on pypy #602

sontek opened this issue Aug 27, 2013 · 4 comments

Comments

@sontek
Copy link

sontek commented Aug 27, 2013

Full call stack

ERROR:gunicorn.error:Socket error processing request.
Traceback (most recent call last):
  File "/home/sontek/.virtualenvs/helloworld_pypy/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/workers/async.py", line 42, in handle
    req = six.next(parser)
  File "/home/sontek/.virtualenvs/helloworld_pypy/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/parser.py", line 39, in __next__
    self.mesg = self.mesg_class(self.cfg, self.unreader, self.req_count)
  File "/home/sontek/.virtualenvs/helloworld_pypy/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 152, in __init__
    super(Request, self).__init__(cfg, unreader)
  File "/home/sontek/.virtualenvs/helloworld_pypy/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 49, in __init__
    unused = self.parse(self.unreader)
  File "/home/sontek/.virtualenvs/helloworld_pypy/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 164, in parse
    self.get_data(unreader, buf, stop=True)
  File "/home/sontek/.virtualenvs/helloworld_pypy/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 155, in get_data
    data = unreader.read()
  File "/home/sontek/.virtualenvs/helloworld_pypy/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/unreader.py", line 38, in read
    d = self.chunk()
  File "/home/sontek/.virtualenvs/helloworld_pypy/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/unreader.py", line 65, in chunk
    return self.sock.recv(self.mxchunk)
  File "/home/sontek/.virtualenvs/helloworld_pypy/site-packages/eventlet-0.13.0-py2.7.egg/eventlet/greenio.py", line 251, in recv
    return fd.recv(buflen, flags)
  File "/usr/lib64/pypy-2.0.2/lib-python/2.7/socket.py", line 188, in recv
    return self._sock.recv(buffersize, flags=flags)
error: [Errno 9] Bad file descriptor

Example code to reproduce: https://github.com/sontek/pyramid_helloworld

@sontek
Copy link
Author

sontek commented Aug 27, 2013

It doesn't happen if you are only returning a response but if you have 2 assets like a favicon and a css file along with a response, then it throws this error.

@sontek
Copy link
Author

sontek commented Aug 27, 2013

Here is callstack from pypy 2.1 instead of 2.0.2:

ERROR:gunicorn.error:Socket error processing request.
Traceback (most recent call last):
  File "/home/sontek/.virtualenvs/notaliens_pypy2.1/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/workers/async.py", line 42, in handle
    req = six.next(parser)
  File "/home/sontek/.virtualenvs/notaliens_pypy2.1/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/parser.py", line 39, in __next__
    self.mesg = self.mesg_class(self.cfg, self.unreader, self.req_count)
  File "/home/sontek/.virtualenvs/notaliens_pypy2.1/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 152, in __init__
    super(Request, self).__init__(cfg, unreader)
  File "/home/sontek/.virtualenvs/notaliens_pypy2.1/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 49, in __init__
    unused = self.parse(self.unreader)
  File "/home/sontek/.virtualenvs/notaliens_pypy2.1/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 164, in parse
    self.get_data(unreader, buf, stop=True)
  File "/home/sontek/.virtualenvs/notaliens_pypy2.1/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 155, in get_data
    data = unreader.read()
  File "/home/sontek/.virtualenvs/notaliens_pypy2.1/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/unreader.py", line 38, in read
    d = self.chunk()
  File "/home/sontek/.virtualenvs/notaliens_pypy2.1/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/unreader.py", line 65, in chunk
    return self.sock.recv(self.mxchunk)
  File "/home/sontek/.virtualenvs/notaliens_pypy2.1/site-packages/eventlet-0.13.0-py2.7.egg/eventlet/greenio.py", line 251, in recv
    return fd.recv(buflen, flags)
  File "/home/sontek/Downloads/pypy-2.1-linux_x86_64-portable/lib-python/2.7/socket.py", line 195, in recv
    return self._sock.recv(buffersize, flags)
  File "/home/sontek/Downloads/pypy-2.1-linux_x86_64-portable/lib-python/2.7/socket.py", line 164, in _dummy
    raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor

@sontek
Copy link
Author

sontek commented Aug 27, 2013

cpython callstack:

2013-08-27 12:19:20 [28796] [ERROR] Socket error processing request.
Traceback (most recent call last):
  File "/home/sontek/.virtualenvs/pyramid_helloworld/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/workers/async.py", line 42, in handle
    req = six.next(parser)
  File "/home/sontek/.virtualenvs/pyramid_helloworld/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/parser.py", line 39, in __next__
    self.mesg = self.mesg_class(self.cfg, self.unreader, self.req_count)
  File "/home/sontek/.virtualenvs/pyramid_helloworld/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 152, in __init__
    super(Request, self).__init__(cfg, unreader)
  File "/home/sontek/.virtualenvs/pyramid_helloworld/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 49, in __init__
    unused = self.parse(self.unreader)
  File "/home/sontek/.virtualenvs/pyramid_helloworld/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 164, in parse
    self.get_data(unreader, buf, stop=True)
  File "/home/sontek/.virtualenvs/pyramid_helloworld/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/message.py", line 155, in get_data
    data = unreader.read()
  File "/home/sontek/.virtualenvs/pyramid_helloworld/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/unreader.py", line 38, in read
    d = self.chunk()
  File "/home/sontek/.virtualenvs/pyramid_helloworld/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/http/unreader.py", line 65, in chunk
    return self.sock.recv(self.mxchunk)
  File "/home/sontek/.virtualenvs/pyramid_helloworld/lib/python2.7/site-packages/eventlet-0.13.0-py2.7.egg/eventlet/greenio.py", line 251, in recv
    return fd.recv(buflen, flags)
  File "/usr/lib64/python2.7/socket.py", line 170, in _dummy
    raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor


@benoitc
Copy link
Owner

benoitc commented Aug 27, 2013

fixed in latest head. thanks for the report

@benoitc benoitc closed this as completed Aug 27, 2013
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

No branches or pull requests

2 participants