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

Python 3.0 support #1

Closed
kanaka opened this issue May 16, 2011 · 6 comments
Closed

Python 3.0 support #1

kanaka opened this issue May 16, 2011 · 6 comments
Labels
feature New feature or request fixed

Comments

@kanaka
Copy link
Member

kanaka commented May 16, 2011

Hopefully 2.X and 3 can be supported in the same code-base or at least by a mostly common module.

@kanaka
Copy link
Member Author

kanaka commented May 16, 2011

Info about using the same code-base for 2.X and 3.X: http://nedbatchelder.com/blog/200910/running_the_same_code_on_python_2x_and_3x.html

@kanaka
Copy link
Member Author

kanaka commented May 17, 2011

Here is a patch that adds python 3 and multiprocessing support: https://gist.github.com/976972

The patch drops python2.4 support for now although the same code base is able to support python 2.6 on up. However, the code is able to trigger a futex hang in python 3.1 so I'm not pushing it into the main tree until that is resolved. The futex hang can be triggered by reloading the noVNC vnc.html page repeatedly until it stops responding. This hang is not related to the WebSockets code since this is just loading the page without doing any WebSocket connections.

stracing the hung python process shows the following:
$ sudo strace -p 2402
[sudo] password for foo:
Process 2402 attached - interrupt to quit
futex(0x1469570, FUTEX_WAIT_PRIVATE, 0, NULL^C <unfinished ...>

When hung like that the process cannot be interrupted with Ctrl-C and must be killed directly.

@kanaka
Copy link
Member Author

kanaka commented May 17, 2011

Include @ysangkok

@kanaka
Copy link
Member Author

kanaka commented May 18, 2011

Okay, I figured out a workaround to the python 3 futex hang. It appears to be related to the fact that websocket.py was doing it's own SIGCHLD child process reaping. The multiprocessing module does it's own SIGCHLD handling so we only have to do SIGCHLD handling when using os.fork() (under python 2.4).

Support has been committed with c858711.

@kanaka kanaka closed this as completed May 18, 2011
@ysangkok
Copy link

It doesn't work right now because you're importing the "resource" module, which is Unix-only. I believe this is not strictly required though, so it might be easily fixed?

@kanaka
Copy link
Member Author

kanaka commented May 18, 2011

@ysangkok, this bug is closed (it works with python 3 on Linux). I made a change to make 'resource' optional and noted it in the win32 bug: #2

ncarrier pushed a commit to ncarrier/carino-packages-websockify that referenced this issue Mar 21, 2015
Instead of doing crazy things with file-descriptors in
SplitHTTPHandler, WSRequestHandler detects a WebSockets upgrade and
returns 101 as the 'last_code'. In addition to avoiding funkiness with
file-descriptors, this allows use of the already parsed headers and
removal of the parse_handshake routine.

This also makes it easier to explore adding python 3.X support
(novnc/websockify#1) since the
file-descriptor/string splitting is very difficult to integrate with
python 3.X.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request fixed
Projects
None yet
Development

No branches or pull requests

2 participants