Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Happened easily AssertionError at websocket.py when connection over 20 clients. #111

Open
dewsxc opened this issue May 24, 2017 · 3 comments

Comments

@dewsxc
Copy link

dewsxc commented May 24, 2017

When I try to send data to each connection, it is easily to occur AssertionError when sending.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "fto.py", line 38, in run
    self.send_message()
  File "fto.py", line 79, in send_message
    c.send(arr)
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sockjs/tornado/conn.py", line 49, in send
    self.session.send_message(message, binary=binary)
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sockjs/tornado/session.py", line 322, in send_message
    self.send_jsonified(proto.json_encode(bytes_to_str(msg)), stats)
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sockjs/tornado/session.py", line 337, in send_jsonified
    self.handler.send_pack('a[%s]' % msg)
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/sockjs/tornado/transports/websocket.py", line 86, in send_pack
    self.write_message(message, binary)
  File "/usr/local/lib/python3.5/site-packages/tornado/websocket.py", line 252, in write_message
    return self.ws_connection.write_message(message, binary=binary)
  File "/usr/local/lib/python3.5/site-packages/tornado/websocket.py", line 783, in write_message
    message = self._compressor.compress(message)
  File "/usr/local/lib/python3.5/site-packages/tornado/websocket.py", line 548, in compress
    assert data.endswith(b'\x00\x00\xff\xff')
AssertionError
@vishal733
Copy link

I faced this issue as well.
In my case it were just a 2-3 connections. Not as many as 15-20 connections.

@garg10may
Copy link

garg10may commented Aug 24, 2018

12346 ERROR:2018-08-24 01:01:59,202:get_broadcast
12347 Traceback (most recent call last):
12348   File "/release/manik/muTrade-1.0.0-1.7.4.5/web/utrade/WebSocket/get_broadcast.py", line 321, in _send_msg_to_clients
12349     socketConnectionObject.send(smart_str(simplejson.dumps(data)))
12350   File "/release/st01/py3Env/lib/python3.6/site-packages/sockjs/tornado/conn.py", line 49, in send
12351     self.session.send_message(message, binary=binary)
12352   File "/release/st01/py3Env/lib/python3.6/site-packages/sockjs/tornado/session.py", line 322, in send_message
12353     self.send_jsonified(proto.json_encode(bytes_to_str(msg)), stats)
12354   File "/release/st01/py3Env/lib/python3.6/site-packages/sockjs/tornado/session.py", line 337, in send_jsonified
12355     self.handler.send_pack('a[%s]' % msg)
12356   File "/release/st01/py3Env/lib/python3.6/site-packages/sockjs/tornado/transports/websocket.py", line 86, in send_pack
12357     self.write_message(message, binary)
12358   File "/release/st01/py3Env/lib/python3.6/site-packages/tornado/websocket.py", line 252, in write_message
12359     return self.ws_connection.write_message(message, binary=binary)
12360   File "/release/st01/py3Env/lib/python3.6/site-packages/tornado/websocket.py", line 783, in write_message
12361     message = self._compressor.compress(message)
12362   File "/release/st01/py3Env/lib/python3.6/site-packages/tornado/websocket.py", line 548, in compress
12363     assert data.endswith(b'\x00\x00\xff\xff')
12364 AssertionError

@mrjoes
Copy link
Owner

mrjoes commented Aug 24, 2018

This is happening inside of the Tornado websocket library after attempting to compress the message before sending it over the TCP socket. I doubt it has something to do with sockjs-tornado, to be honest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants