socketIO-client icon indicating copy to clipboard operation
socketIO-client copied to clipboard

HeartbeatThread exception not caught. Hang.

Open tlc opened this issue 10 years ago • 2 comments

The following stack trace shows an exception rising through heartbeats.py to threading.py at which point the heartbeat thread is done, but the starting thread is not notified and my app is unaware that it's not communicating.

2015-11-19T15:30:59.854815997Z Exception in thread Thread-1:
2015-11-19T15:30:59.854888374Z Traceback (most recent call last):
2015-11-19T15:30:59.854897085Z   File "/usr/local/lib/python3.4/dist-packages/websocket/_socket.py", line 112, in send
2015-11-19T15:30:59.854904466Z     return sock.send(data)
2015-11-19T15:30:59.854910262Z   File "/usr/lib/python3.4/ssl.py", line 684, in send
2015-11-19T15:30:59.854916015Z     v = self._sslobj.write(data)
2015-11-19T15:30:59.854922098Z ssl.SSLError: [SSL: BAD_WRITE_RETRY] bad write retry (_ssl.c:1638)
2015-11-19T15:30:59.854927764Z 
2015-11-19T15:30:59.854933113Z During handling of the above exception, another exception occurred:
2015-11-19T15:30:59.854938686Z 
2015-11-19T15:30:59.854944042Z Traceback (most recent call last):
2015-11-19T15:30:59.854949448Z   File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
2015-11-19T15:30:59.854955102Z     self.run()
2015-11-19T15:30:59.854960588Z   File "/usr/local/lib/python3.4/dist-packages/socketIO_client/heartbeats.py", line 27, in run
2015-11-19T15:30:59.854966381Z     self._send_heartbeat()
2015-11-19T15:30:59.854971937Z   File "/usr/local/lib/python3.4/dist-packages/socketIO_client/__init__.py", line 192, in _ping
2015-11-19T15:30:59.854977618Z     engineIO_packet_type, engineIO_packet_data)
2015-11-19T15:30:59.855009325Z   File "/usr/local/lib/python3.4/dist-packages/socketIO_client/transports.py", line 161, in send_packet
2015-11-19T15:30:59.855021129Z     self._connection.send(packet)
2015-11-19T15:30:59.855029964Z   File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 289, in send
2015-11-19T15:30:59.855039176Z     return self.send_frame(frame)
2015-11-19T15:30:59.855048133Z   File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 314, in send_frame
2015-11-19T15:30:59.855057333Z     l = self._send(data)
2015-11-19T15:30:59.855066124Z   File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 475, in _send
2015-11-19T15:30:59.855075182Z     return send(self.sock, data)
2015-11-19T15:30:59.855087714Z   File "/usr/local/lib/python3.4/dist-packages/websocket/_socket.py", line 118, in send
2015-11-19T15:30:59.855097319Z     if message and "timed out" in message:
2015-11-19T15:30:59.855110993Z TypeError: argument of type 'int' is not iterable

Perhaps HeartbeatThread run should catch all exceptions and notify the starting thread or retry.

tlc avatar Nov 19 '15 16:11 tlc

Using 0.6.5.

tlc avatar Nov 19 '15 16:11 tlc

Hmm, good idea.

invisibleroads avatar Nov 19 '15 18:11 invisibleroads