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

ws4py.client.threadedclient is not compatible with ws4py.server.cherrypyserver #44

Closed
EliAndrewC opened this issue Apr 4, 2012 · 1 comment

Comments

@EliAndrewC
Copy link
Contributor

We've been unable to run a CherryPy websocket server and then connect to it with the ws4py.client.threadedclient library without seeing unexpected connection closes and exceptions. This even happens with the example CherryPy echo client / server code. To reproduce, you can enter the following commands in a console:

python2.7 -m virtualenv --no-site-packages env
source env/bin/activate
pip install http://www.defuze.org/oss/ws4py/ws4py-0.2.1.tar.gz
pip install http://download.cherrypy.org/cherrypy/3.2.2/CherryPy-3.2.2.tar.gz
git clone https://github.com/Lawouach/WebSocket-for-Python.git
python WebSocket-for-Python/example/echo_cherrypy_server.py

and then in another console in the same directory type:

source env/bin/activate
python WebSocket-for-Python/example/echo_client.py

and you'll see the following output

0
25
50
75
100
125
150
175
=> 708 ####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
=> 0 
=> 25 *************************
=> 50 **************************************************
=> 75 ***************************************************************************
=> 100 ****************************************************************************************************
=> 125 *****************************************************************************************************************************
=> 150 ******************************************************************************************************************************************************
=> 175 *******************************************************************************************************************************************************************************
Closed down 1006 Going away
Exception in thread WebSocketClient:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/eli/temp/ws4py/env/lib/python2.7/site-packages/ws4py/websocket.py", line 230, in run
    if not process(bytes):
  File "/home/eli/temp/ws4py/env/lib/python2.7/site-packages/ws4py/websocket.py", line 265, in process
    self.reading_buffer_size = s.parser.send(bytes) or DEFAULT_READING_SIZE
  File "/home/eli/temp/ws4py/env/lib/python2.7/site-packages/ws4py/streaming.py", line 258, in receiver
    is_valid, end_on_code_point, _, _ = utf8validator.validate(reason)
  File "/home/eli/temp/ws4py/env/lib/python2.7/site-packages/ws4py/utf8validator.py", line 108, in validate
    self.state = Utf8Validator.UTF8VALIDATOR_DFA[256 + (self.state << 4) + Utf8Validator.UTF8VALIDATOR_DFA[ba[i]]]
TypeError: list indices must be integers, not str

So it looks like the data transfer works for awhile, but then shuts down before all of the data can be sent back and forth. This did not happen in previous versions; we're still using ws4py 0.1.3 for our development because this doesn't seem to happen with that release.

We have reproduced this issue on both Python 2.6 and 2.7, and it occurs on both OSX and Ubuntu. Please let me know if there's anything else I can do to help.

@Lawouach
Copy link
Owner

Lawouach commented Apr 9, 2012

Indeed there's a bug here. I'll look into it.

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

2 participants