You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am getting an exception when I call shutdown_gracefully()
ERROR:websocket_server.websocket_server:********************************************************************************
Exception in child thread <WebsocketServerThread(Thread-162 (serve_forever), started daemon 25036)>: [WinError 10038] An operation was attempted on something that is not a socket
Looks like the issue is that the thread is still running when the websocket is closed and this triggers an operation of the closed socket
Any hint?
The text was updated successfully, but these errors were encountered:
I think the solution is to reorder the shout down functions and as good measure add a join
def _shutdown_gracefully(self, status=CLOSE_STATUS_NORMAL, reason=DEFAULT_CLOSE_REASON):
"""
Send a CLOSE handshake to all connected clients before terminating server
"""
self.keep_alive = False
self._disconnect_clients_gracefully(status, reason)
self.shutdown()
self.thread.join()
self.server_close()
def _shutdown_abruptly(self):
"""
Terminate server without sending a CLOSE handshake
"""
self.keep_alive = False
self._disconnect_clients_abruptly()
self.shutdown()
self.thread.join()
self.server_close()
I think the solution is to reorder the shout down functions and as good measure add a join
def _shutdown_gracefully(self, status=CLOSE_STATUS_NORMAL, reason=DEFAULT_CLOSE_REASON):
"""
Send a CLOSE handshake to all connected clients before terminating server
"""
self.keep_alive = False
self._disconnect_clients_gracefully(status, reason)
self.shutdown()
self.thread.join()
self.server_close()
def _shutdown_abruptly(self):
"""
Terminate server without sending a CLOSE handshake
"""
self.keep_alive = False
self._disconnect_clients_abruptly()
self.shutdown()
self.thread.join()
self.server_close()
Hi, bro~it seems to test failed. But my console output :
Hi,
I am getting an exception when I call shutdown_gracefully()
ERROR:websocket_server.websocket_server:********************************************************************************
Exception in child thread <WebsocketServerThread(Thread-162 (serve_forever), started daemon 25036)>: [WinError 10038] An operation was attempted on something that is not a socket
Looks like the issue is that the thread is still running when the websocket is closed and this triggers an operation of the closed socket
Any hint?
The text was updated successfully, but these errors were encountered: