socketIO-client
socketIO-client copied to clipboard
Index out of range error
I'm using 0.7.2 and every so often I see the following error being logged:
Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib/python3.4/threading.py", line 868, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.4/dist-packages/socketIO_client/__init__.py", line 251, in wait
self._process_packets()
File "/usr/local/lib/python3.4/dist-packages/socketIO_client/__init__.py", line 276, in _process_packets
for engineIO_packet in self._transport.recv_packet():
File "/usr/local/lib/python3.4/dist-packages/socketIO_client/transports.py", line 158, in recv_packet
packet_text)
File "/usr/local/lib/python3.4/dist-packages/socketIO_client/parsers.py", line 96, in parse_packet_text
packet_type = int(get_character(packet_text, 0))
File "/usr/local/lib/python3.4/dist-packages/socketIO_client/symmetries.py", line 33, in get_character
return chr(get_byte(x, index))
File "/usr/local/lib/python3.4/dist-packages/socketIO_client/symmetries.py", line 29, in get_byte
return indexbytes(x, index)
IndexError: index out of range
It then is disconnected (but the events for disconnection never fire) and I then have to restart the service.
It looks kinda similar to #129 but not exactly the same.
Any ideas here? Still seeing this issue intermittently...
Exception in thread Thread-4: Traceback (most recent call last): File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner self.run() File "/usr/lib/python3.4/threading.py", line 868, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.4/dist-packages/socketIO_client/init.py", line 251, in wait self._process_packets() File "/usr/local/lib/python3.4/dist-packages/socketIO_client/init.py", line 276, in _process_packets for engineIO_packet in self._transport.recv_packet(): File "/usr/local/lib/python3.4/dist-packages/socketIO_client/transports.py", line 158, in recv_packet packet_text) File "/usr/local/lib/python3.4/dist-packages/socketIO_client/parsers.py", line 96, in parse_packet_text packet_type = int(get_character(packet_text, 0)) File "/usr/local/lib/python3.4/dist-packages/socketIO_client/symmetries.py", line 33, in get_character return chr(get_byte(x, index)) File "/usr/local/lib/python3.4/dist-packages/socketIO_client/symmetries.py", line 29, in get_byte return indexbytes(x, index) IndexError: index out of range
Hi Tadimsky, did you ever find a solution to this problem??
@robertlevy11 no, unfortunately not. still have this issue... I'm using it to connect between a Raspberry Pi and a server for communication but the connection keeps going down :(
Plus one, same error as your gays.
Traceback (most recent call last): File "/Users/leek/Code/PycharmProjects/ExampleFunction/js.socketio_test.py", line 29, in <module> verify=False) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socketIO_client/__init__.py", line 345, in __init__ resource, hurry_interval_in_seconds, **kw) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socketIO_client/__init__.py", line 58, in __init__ self._transport File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socketIO_client/__init__.py", line 66, in _transport self._engineIO_session = self._get_engineIO_session() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socketIO_client/__init__.py", line 80, in _get_engineIO_session transport.recv_packet()) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socketIO_client/transports.py", line 92, in recv_packet for engineIO_packet in decode_engineIO_content(response.content): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socketIO_client/parsers.py", line 95, in decode_engineIO_content content, content_index) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socketIO_client/parsers.py", line 202, in _read_packet_length while get_byte(content, content_index) not in [0, 1]: File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/socketIO_client/symmetries.py", line 36, in get_byte return six.indexbytes(x, index) IndexError: index out of range
@l33klin @robertlevy11 do you guys know if there is some other library to use? Looks like this one is no longer active. :(
I don't konw, i have the same error. I need a connection on the localhost from my server. On the Raspberry Pi it works without problems
See here: Install the pip package: socketIO-client-nexus For me it worked!
https://github.com/nexus-devs/socketIO-client-2.0.3
+1, I have the same problem with this client. After a few hours this error shows up.
I am facing the same issue with Centos 6.9, ain't there a solution yet? this works fine with windows, only the error comes when testing with the centos
So far I solved it but setting restart time to like 60 minutes, seems to keep the client up 24\7 now
@Nixellion how did you fix it?
@nm3594 As I mention in my previous post, I set it to only listen for 1 hour, then reconnect.
while True:
RESTART_DELAY = 60 # in minutes
socketIO.wait(seconds=RESTART_DELAY * 60) # conversion for minutes
@Nixellion the application I use must response less than 1 second. :(
@Roledenez Oh no, this code makes the client RESTART and RECONNECT each hour. It listens for an hour, responding instantly for any incoming message, then it restarts itself and listens for another hour. Or whatever time you set. It responds instantly.
I'm also having this issue:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/socketlib.py", line 71, in _receive_events_thread
self.socket_io.wait()
File "/usr/local/lib/python3.7/site-packages/socketIO_client/__init__.py", line 251, in wait
self._process_packets()
File "/usr/local/lib/python3.7/site-packages/socketIO_client/__init__.py", line 276, in _process_packets
for engineIO_packet in self._transport.recv_packet():
File "/usr/local/lib/python3.7/site-packages/socketIO_client/transports.py", line 158, in recv_packet
packet_text)
File "/usr/local/lib/python3.7/site-packages/socketIO_client/parsers.py", line 96, in parse_packet_text
packet_type = int(get_character(packet_text, 0))
File "/usr/local/lib/python3.7/site-packages/socketIO_client/symmetries.py", line 33, in get_character
return chr(get_byte(x, index))
File "/usr/local/lib/python3.7/site-packages/socketIO_client/symmetries.py", line 29, in get_byte
return indexbytes(x, index)
IndexError: index out of range
I managed to quickly reproduce it by spawning a lot (1000) threads, all connecting to the same server, and for each connection go into a loop and do emit
.
At the end my problem was that I was using AWS. Now with the same library and the same code I don't have any problem using Google Cloud Compute Engine
@nicolamarinello what kind of problem you had with AWS? exactly same than in description? Did you use ALB/ELB? Have you seen any 502 rest failures? We have seen also problems with AWS with ALB but mostly with REST..
I have the same problem with socketIO_client_nexus 0.7.6.
It can happen as early as 5 seconds after the connection is open.
The server is a nodeJS server using some implementation of socketIO 2. One thing I did change is putting the server behind a load balancer. I don't recall having this issue with a single instance of the server.