[ERROR] Socket error processing request.

See original GitHub issue

I get the following error every now and then when running with gunicorn. I am not sure why or when this happens.

[2015-10-18 19:56:52 -0500] [17657] [ERROR] Socket error processing request.
Traceback (most recent call last):
  File ".../venv/lib/python2.7/site-packages/gunicorn/workers/async.py", line 64, in handle
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File ".../venv/lib/python2.7/site-packages/gunicorn/workers/async.py", line 52, in handle
    self.handle_request(listener_name, req, client, addr)
  File ".../venv/lib/python2.7/site-packages/gunicorn/workers/async.py", line 127, in handle_request
    six.reraise(*sys.exc_info())
  File ".../venv/lib/python2.7/site-packages/gunicorn/workers/async.py", line 113, in handle_request
    resp.write(item)
  File ".../venv/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 324, in write
    self.send_headers()
  File ".../venv/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 320, in send_headers
    util.write(self.sock, util.to_bytestring(header_str))
  File "...venv/lib/python2.7/site-packages/gunicorn/util.py", line 300, in write
    sock.sendall(data)
  File ".../venv/lib/python2.7/site-packages/eventlet/greenio/base.py", line 376, in sendall
    tail = self.send(data, flags)
  File ".../venv/lib/python2.7/site-packages/eventlet/greenio/base.py", line 359, in send
    total_sent += fd.send(data[total_sent:], flags)
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 174, in _dummy
    raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
miguelgrinbergcommented, Mar 7, 2016

These are benign errors that I believe to be caused by gunicorn, eventlet and gevent. The error means that the server tried to write or read from a socket that out of nowhere got closed. The issue occurs when the client abruptly leaves a HTTP or WebSocket connection, without properly closing it. The typical case is when you close the browser window. In many cases the web server detects this condition and suppresses the “broken pipe”, “bad file descriptor” or similar error that results from it, but there are several situations where this error is not capture, so you see it in your log.

1reaction
Bektcommented, Oct 19, 2015

I see that’s the long-polling request is finished and the connection is upgraded to websocket. And whenever a client leaves, I see that disconnect event is firing properly. Would your response still be the case in this scenario?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Socket error processing request with flask, gunicorn, docker ...
Running a python flask app with gunicorn. When I spin up the docker image locally everything is fine, but when I run the...
Read more >
Socket error processing request / connection time out
Hi, My Django dokku website runs fine for a short time and then hangs (starting page can no longer loads). The log error...
Read more >
[ERROR] Socket error processing request. - Bountysource
I get the following error every now and then when running with gunicorn. I am not sure why or when this happens.
Read more >
An operation was attempted on something that is not a socket.
Unexpected error while processing request: An operation was attempted on something that is not a socket. What does it mean? Where do I...
Read more >
Socket error processing request with flask, gunicorn, docker ...
[Solved]-Socket error processing request with flask, gunicorn, docker and azure-docker · score:0. Upgrading python version from 3.6. · score:0. I have changed ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found