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
I'm running into a weird error. I'm running websocketproxy.py on Windows 7, on Python 3.2 (which seems to be the only Windows Python that actually works with this script - apparently neither 2.7 nor 3.3 support the requisite APIs). And for quite a while, everything seemed to work fine. But the script has sometimes started throwing an index out of range exception every time a client tries to connect:
F:\source\thirdparty\websockify\websockify>websocketproxy.py 5901 localhost:4511
WARNING: no 'resource' module, daemonizing is slower or disabled
WebSocket server settings:
- Listen on :5901
- Flash security policy server
- No SSL/TLS support (no cert file)
- proxying from :5901 to localhost:4511
WARNING: no 'resource' module, daemonizing is slower or disabled
1: handler exception: index out of range
WARNING: no 'resource' module, daemonizing is slower or disabled
2: handler exception: index out of range
WARNING: no 'resource' module, daemonizing is slower or disabled
3: handler exception: index out of range
Sometimes the script will work fine, but once it starts throwing this exception, I can't get it to stop. Often, neither restarting the script, nor restarting the browser, nor restarting the VNC server to which it's connecting, will fix the problem.
This block of code from websocket.py seems to be the problematic one:
try:
self.client = self.do_handshake(startsock, address)
if self.record:
# Record raw frame data as JavaScript array
fname = "%s.%s" % (self.record,
self.handler_id)
self.msg("opening record file: %s" % fname)
self.rec = open(fname, 'w+')
encoding = "binary"
if self.base64: encoding = "base64"
self.rec.write("var VNC_frame_encoding = '%s';\n"
% encoding)
self.rec.write("var VNC_frame_data = [\n")
self.ws_connection = True
self.new_client()
except self.CClose:
# Close the client
_, exc, _ = sys.exc_info()
if self.client:
self.send_close(exc.args[0], exc.args[1])
except self.EClose:
_, exc, _ = sys.exc_info()
# Connection was not a WebSockets connection
if exc.args[0]:
self.msg("%s: %s" % (address[0], exc.args[0]))
except Exception:
_, exc, _ = sys.exc_info()
self.msg("handler exception: %s" % str(exc))
if self.verbose:
self.msg(traceback.format_exc())
I've tried debugging it myself, but I'm a Python newbie, and it seems to create a separate process for each connection, which means that the IDLE debugger doesn't seem to want to show me what's happening in that new process.
Any suggestions about what it might be, or how to troubleshoot it?
The text was updated successfully, but these errors were encountered:
Well, I've made a bit of progress. By putting in simple debug statements, I've been able to track it down to how websocket.do_handshake handles the incoming handshake. Apparently the incoming handshake is sometimes just an empty array of bytes, but the way the script checks to see if it's empty is to compare it to an empty string. I don't know under what circumstances that check is appropriate, but it doesn't seem to be working as intended on Python 3.2 on Windows. So I modified it from this:
handshake = sock.recv(1024, socket.MSG_PEEK)
if handshake == "" or len(handshake) == 0:
raise self.EClose("ignoring empty handshake")
That seems to be the appropriate intent of the code, at any rate. But I'm still scratching my head as to why the handshake is empty in the first place.
Interesting. I can't seem to get this to happen with IE or Firefox, just with Chrome. I'm using this with your noVNC library. Any idea why Chrome might handle this stuff different than IE or FF?
Also, if shut down Chrome and reload it, the error still happens. But if I shut down Chrome, connect with IE or FF, then shut those down, and then reconnect with Chrome, it works. Very odd.
I'm running into a weird error. I'm running websocketproxy.py on Windows 7, on Python 3.2 (which seems to be the only Windows Python that actually works with this script - apparently neither 2.7 nor 3.3 support the requisite APIs). And for quite a while, everything seemed to work fine. But the script has sometimes started throwing an
index out of range
exception every time a client tries to connect:Sometimes the script will work fine, but once it starts throwing this exception, I can't get it to stop. Often, neither restarting the script, nor restarting the browser, nor restarting the VNC server to which it's connecting, will fix the problem.
This block of code from websocket.py seems to be the problematic one:
I've tried debugging it myself, but I'm a Python newbie, and it seems to create a separate process for each connection, which means that the IDLE debugger doesn't seem to want to show me what's happening in that new process.
Any suggestions about what it might be, or how to troubleshoot it?
The text was updated successfully, but these errors were encountered: