guv icon indicating copy to clipboard operation
guv copied to clipboard

OSError Bad file descriptor when stress testing with Thor

Open dmdm opened this issue 9 years ago • 0 comments

I use the simple WebSocket Server as described in #27. When I stress test it with Thor, the workers quit with OSError Bad file descriptor:

[2015-07-11 16:25:43 +0200] [3256] [ERROR] Socket error processing request.
Traceback (most recent call last):
  File "/home/dm/myprojects/Parenchym/libguv/guv/support/gunicorn_worker.py", line 93, in handle
    reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/home/dm/myprojects/Parenchym/libguv/guv/support/__init__.py", line 19, in reraise
    raise value
  File "/home/dm/myprojects/Parenchym/libguv/guv/support/gunicorn_worker.py", line 80, in handle
    self.handle_request(server_name, req, client_sock, addr)
  File "/home/dm/myprojects/Parenchym/libguv/guv/support/gunicorn_worker.py", line 134, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/dm/myprojects/Parenchym/libguv/guv/websocket.py", line 139, in __call__
    self.handler(ws)
  File "/home/dm/myprojects/foo/sock/srv.py", line 43, in my_handler
    ws.send(resp)
  File "/home/dm/myprojects/Parenchym/libguv/guv/websocket.py", line 658, in send
    self._send(payload)
  File "/home/dm/myprojects/Parenchym/libguv/guv/websocket.py", line 651, in _send
    self.socket.sendall(frame)
  File "/home/dm/myprojects/Parenchym/libguv/guv/greenio.py", line 222, in sendall
    b_sent = self.send(mv, flags)
  File "/home/dm/myprojects/Parenchym/libguv/guv/greenio.py", line 204, in send
    return super().send(data, flags)
OSError: [Errno 9] Bad file descriptor

Commenting out the ws.send(), i.o.w. just reading from the socket, seems to work.

This is the Thor command:

$ ./node_modules/thor/bin/thor ws://localhost:7098 --amount 2 --buffer 10240

Update: Could it be related to the issue (and fix) mentioned here?

dmdm avatar Jul 11 '15 14:07 dmdm