dpallot / simple-websocket-server

A python based websocket server that is simple and easy to use.
951 stars 321 forks source link

Occasional "bad file descriptor" crash #7

Closed ojensen5115 closed 10 years ago

ojensen5115 commented 10 years ago

I got the following crash:

Traceback (most recent call last): File "chat.py", line 662, in server.serveforever() File "/path/SimpleWebSocketServer/SimpleWebSocketServer.py", line 607, in serveforever super(SimpleSSLWebSocketServer, self).serveforever() File "/path/SimpleWebSocketServer/SimpleWebSocketServer.py", line 541, in serveforever fileno = client.client.fileno() File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) File "/usr/lib/python2.7/socket.py", line 170, in _dummy raise error(EBADF, 'Bad file descriptor')

I'm not really sure what caused it.

ojensen5115 commented 10 years ago

Also got

Traceback (most recent call last): File "chat.py", line 662, in server.serveforever() File "/path/SimpleWebSocketServer/SimpleWebSocketServer.py", line 607, in serveforever super(SimpleSSLWebSocketServer, self).serveforever() File "/path/SimpleWebSocketServer/SimpleWebSocketServer.py", line 522, in serveforever rList, wList, xList = select(self.listeners, [], self.listeners, 1) select.error: (9, 'Bad file descriptor')

dpallot commented 10 years ago

This is interesting. Are you calling the socket close() function in your client? I have removed the redundant fileno() call as the descriptor is given in the exception list.

ojensen5115 commented 10 years ago

Hm, yes I do believe so... the problem may well exist on my end. I'll investigate and update.

ojensen5115 commented 10 years ago

Indeed, the problem was on my end (I was in fact calling the socket.close() function). Sorry about the false report, and thanks for a great library!