[GH-ISSUE #503] Unexpected close while ready - novnc after 20 sec #373

Open
opened 2026-02-27 16:39:03 +03:00 by kerem · 21 comments
Owner

Originally created by @GusevVictor on GitHub (Feb 15, 2015).
Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/503

Hi all, I have setup this nice product from master brunch on ubuntu 14.04, so, in Ubuntu 14.04 novnc doesn't have a daemon module, and there no command like this:

$ sudo service novnc stop
$ sudo insserv -r novnc

Is it a normal?

So, my problem is about novnc, it closes any connection to vm after 15-20sec, every time. I don't have any proxy or SSL, just fresh install.

Can you help me with it?

There is no any kind of log for that.

Thank a lot for any help!

Originally created by @GusevVictor on GitHub (Feb 15, 2015). Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/503 Hi all, I have setup this nice product from master brunch on ubuntu 14.04, so, in Ubuntu 14.04 novnc doesn't have a daemon module, and there no command like this: $ sudo service novnc stop $ sudo insserv -r novnc Is it a normal? So, my problem is about novnc, it closes any connection to vm after 15-20sec, every time. I don't have any proxy or SSL, just fresh install. Can you help me with it? There is no any kind of log for that. Thank a lot for any help!
Author
Owner

@brenard commented on GitHub (Feb 16, 2015):

Hello,

I reproduce the same bug and after some hours of search, it's appear to be (in my case) a bug related with websockify/novnc libraries : when this libraries handle the SIGCHLD, the connection it's kill after some seconds. If I comment the lines witch handle this signal, the connection work fine. You could try this work around by editing websocket.py file, search and comment this lines :

    if not multiprocessing:
        # os.fork() (python 2.4) child reaper
        signal.signal(signal.SIGCHLD, self.fallback_SIGCHLD)
    else:
        # make sure that _cleanup is called when children die
        # by calling active_children on SIGCHLD
        signal.signal(signal.SIGCHLD, self.multiprocessing_SIGCHLD)

I still working on it, so if I found a better way to fix this issue, I will give you feed back.

<!-- gh-comment-id:74481082 --> @brenard commented on GitHub (Feb 16, 2015): Hello, I reproduce the same bug and after some hours of search, it's appear to be (in my case) a bug related with websockify/novnc libraries : when this libraries handle the SIGCHLD, the connection it's kill after some seconds. If I comment the lines witch handle this signal, the connection work fine. You could try this work around by editing websocket.py file, search and comment this lines : ``` if not multiprocessing: # os.fork() (python 2.4) child reaper signal.signal(signal.SIGCHLD, self.fallback_SIGCHLD) else: # make sure that _cleanup is called when children die # by calling active_children on SIGCHLD signal.signal(signal.SIGCHLD, self.multiprocessing_SIGCHLD) ``` I still working on it, so if I found a better way to fix this issue, I will give you feed back.
Author
Owner

@GusevVictor commented on GitHub (Feb 16, 2015):

Thank a lot for a your investigation for this bug. I have changed file (ubuntu 14.04): /usr/lib/python2.7/dist-packages/websockify/websocket.py , NOT: /usr/lib/python2.7/dist-packages/novnc/websocket.py

After changle it looks like OK! I hope it'll be fixed by a normal way rather than this workarround.

THANK YOU AGAIN, for your spent time for that!

<!-- gh-comment-id:74513647 --> @GusevVictor commented on GitHub (Feb 16, 2015): Thank a lot for a your investigation for this bug. I have changed file (ubuntu 14.04): /usr/lib/python2.7/dist-packages/websockify/websocket.py , NOT: /usr/lib/python2.7/dist-packages/novnc/websocket.py After changle it looks like OK! I hope it'll be fixed by a normal way rather than this workarround. THANK YOU AGAIN, for your spent time for that!
Author
Owner

@brenard commented on GitHub (Feb 16, 2015):

Like I say, I still working on it. I find that it's when connection is make over SSH tunnel that we have this issue. In fact, it's seam to be the SSH process (running to tunneling the connection) that is dies and resulting process receive a SIGCHLD. Tunnel library don't handle this signal while websockify handle it and it cause that all the stack in place for the client connection is killed.

When disabling SIGCHLD handling, it should causes some zombie process. In fact, in must cases, the SSH process will automatically ending when web user disconnect. But, on my workstation, I have actually 13 SSH zombie process...

I found a lot of relative bug report in differents projects using SSH tunneling : certain appear to be magically resolved and some other is unintelligible for me. So, I have currently no solution for this issue.

<!-- gh-comment-id:74527269 --> @brenard commented on GitHub (Feb 16, 2015): Like I say, I still working on it. I find that it's when connection is make over SSH tunnel that we have this issue. In fact, it's seam to be the SSH process (running to tunneling the connection) that is dies and resulting process receive a SIGCHLD. Tunnel library don't handle this signal while websockify handle it and it cause that all the stack in place for the client connection is killed. When disabling SIGCHLD handling, it should causes some zombie process. In fact, in must cases, the SSH process will automatically ending when web user disconnect. But, on my workstation, I have actually 13 SSH zombie process... I found a lot of relative bug report in differents projects using SSH tunneling : certain appear to be magically resolved and some other is unintelligible for me. So, I have currently no solution for this issue.
Author
Owner

@GusevVictor commented on GitHub (Feb 16, 2015):

Dear brenard, it is a very interesting story about ssh tunnel. I'm very sadly but I can't help you with it. I work just as a system administrator and I don't have any experience with programming.

Thank you. I hope this problem will give you new skills.

Best regards,
Victor.

<!-- gh-comment-id:74560924 --> @GusevVictor commented on GitHub (Feb 16, 2015): Dear brenard, it is a very interesting story about ssh tunnel. I'm very sadly but I can't help you with it. I work just as a system administrator and I don't have any experience with programming. Thank you. I hope this problem will give you new skills. Best regards, Victor.
Author
Owner

@brenard commented on GitHub (Feb 16, 2015):

@GusevVictor : no problem, I say that for all other devs witch could transit by this issue ;) Thanks for your return, it's one way to help free software to progress ;)

<!-- gh-comment-id:74563815 --> @brenard commented on GitHub (Feb 16, 2015): @GusevVictor : no problem, I say that for all other devs witch could transit by this issue ;) Thanks for your return, it's one way to help free software to progress ;)
Author
Owner

@ITFactoryAUT commented on GitHub (Mar 6, 2015):

@brenard Is there any progress on this issue yet?

<!-- gh-comment-id:77646441 --> @ITFactoryAUT commented on GitHub (Mar 6, 2015): @brenard Is there any progress on this issue yet?
Author
Owner

@brenard commented on GitHub (Mar 7, 2015):

@WhiteIntel No, I didn't found any time to work on it. The work around fix the problem for you ?

<!-- gh-comment-id:77682276 --> @brenard commented on GitHub (Mar 7, 2015): @WhiteIntel No, I didn't found any time to work on it. The work around fix the problem for you ?
Author
Owner

@ITFactoryAUT commented on GitHub (Mar 7, 2015):

@brenard I´m using spice but when I commented the lines you suggested I´m not able to connect.

<!-- gh-comment-id:77694988 --> @ITFactoryAUT commented on GitHub (Mar 7, 2015): @brenard I´m using spice but when I commented the lines you suggested I´m not able to connect.
Author
Owner

@ITFactoryAUT commented on GitHub (Mar 30, 2015):

@retspen Any idea?

<!-- gh-comment-id:87794473 --> @ITFactoryAUT commented on GitHub (Mar 30, 2015): @retspen Any idea?
Author
Owner

@bkanuka commented on GitHub (Apr 4, 2015):

I'd like to add that I am having this issue also. noVNC disconnects after exactly 30 seconds when running websockify from webvirtmgr-console (i.e. the recommended way of doing things). I do NOT have this problem when I run websockify from the command line: websockify 0.0.0.0:6080 vmhost:5900

I am not doing an SSH tunneling.

<!-- gh-comment-id:89637022 --> @bkanuka commented on GitHub (Apr 4, 2015): I'd like to add that I am having this issue also. noVNC disconnects after exactly 30 seconds when running websockify from `webvirtmgr-console` (i.e. the recommended way of doing things). I do NOT have this problem when I run websockify from the command line: `websockify 0.0.0.0:6080 vmhost:5900` I am not doing an SSH tunneling.
Author
Owner

@bkanuka commented on GitHub (Apr 4, 2015):

I've done some bug hunting. The error lives in webvirtmgr-console around line 137:

try:
        self.msg("Start proxying")
        self.do_proxy(tsock)

self.do_proxy(tsock) hangs after 30 seconds and doesn't go any farther. Okay so what's do_proxy?

Thats in /usr/lib/python2.7/dist-packages/websockify/websocketproxy.py or wherever it lives for you. The "hang" happens line 136: ins, outs, excepts = select(rlist, wlist, [], 1) This call runs successfully a bunch of times in a while True but eventually throws a exception: select.error error: (4, 'Interrupted system call')

...and I have no idea why this happens :-)

<!-- gh-comment-id:89679657 --> @bkanuka commented on GitHub (Apr 4, 2015): I've done some bug hunting. The error lives in `webvirtmgr-console` around line 137: ``` try: self.msg("Start proxying") self.do_proxy(tsock) ``` `self.do_proxy(tsock)` hangs after 30 seconds and doesn't go any farther. Okay so what's `do_proxy`? Thats in `/usr/lib/python2.7/dist-packages/websockify/websocketproxy.py` or wherever it lives for you. The "hang" happens line 136: `ins, outs, excepts = select(rlist, wlist, [], 1)` This call runs successfully a bunch of times in a `while True` but eventually throws a exception: `select.error error: (4, 'Interrupted system call')` ...and I have no idea why this happens :-)
Author
Owner

@bkanuka commented on GitHub (Apr 5, 2015):

I submitted a pull request to websockify that basically ignores the issue - which in this case, is kinda a reasonable thing to do. I'm not sure exactly where the issue is: websockify or webvirtmgr, but if my pull goes through over there, I'd recommend closing this bug. See here for more: https://github.com/kanaka/websockify/issues/166

<!-- gh-comment-id:89692627 --> @bkanuka commented on GitHub (Apr 5, 2015): I submitted a pull request to websockify that basically ignores the issue - which in this case, is kinda a reasonable thing to do. I'm not sure exactly where the issue is: websockify or webvirtmgr, but if my pull goes through over there, I'd recommend closing this bug. See here for more: https://github.com/kanaka/websockify/issues/166
Author
Owner

@brenard commented on GitHub (May 24, 2015):

The pull request of @bkanuka was merged : https://github.com/kanaka/websockify/issues/166

We have to check that upstream version of websockify fix this issue and I hope, we could close it.

<!-- gh-comment-id:105026900 --> @brenard commented on GitHub (May 24, 2015): The pull request of @bkanuka was merged : https://github.com/kanaka/websockify/issues/166 We have to check that upstream version of websockify fix this issue and I hope, we could close it.
Author
Owner

@ITFactoryAUT commented on GitHub (May 29, 2015):

Well I updated websockify to the latest version (0.6.1) and now I´m not able to connect anyway:
Error with spice:
Error: Unexpected protocol mismatch.
at WebSocket. (http://mgmt..at/static/js/spice-html5/spiceconn.js:96:21)
Error with vnc:
New state 'failed', was 'ProtocolVersion'. Msg: Failed to connect to server (code: 1006)Util.Error @ util.js:111

<!-- gh-comment-id:106759054 --> @ITFactoryAUT commented on GitHub (May 29, 2015): Well I updated websockify to the latest version (0.6.1) and now I´m not able to connect anyway: Error with spice: Error: Unexpected protocol mismatch. at WebSocket.<anonymous> (http://mgmt.<mydomain>.at/static/js/spice-html5/spiceconn.js:96:21) Error with vnc: New state 'failed', was 'ProtocolVersion'. Msg: Failed to connect to server (code: 1006)Util.Error @ util.js:111
Author
Owner

@kkasberg commented on GitHub (Jul 20, 2015):

I am still having this issue. I get disconnected after 30 seconds. I am not using a proxy or SSL. I checked that I have the changes suggested by brenard, and I am still having the issue. Is this resolved for everyone else?

<!-- gh-comment-id:122729100 --> @kkasberg commented on GitHub (Jul 20, 2015): I am still having this issue. I get disconnected after 30 seconds. I am not using a proxy or SSL. I checked that I have the changes suggested by brenard, and I am still having the issue. Is this resolved for everyone else?
Author
Owner

@ITFactoryAUT commented on GitHub (Jul 20, 2015):

The issue still exists on my server too.
Still annoying and still no fix for that.
On Jul 20, 2015 4:02 AM, "kkasberg" notifications@github.com wrote:

I am still having this issue. I get disconnected after 30 seconds. I am
not using a proxy or SSL. I checked that I have the changes suggested by
brenard, and I am still having the issue. Is this resolved for everyone
else?


Reply to this email directly or view it on GitHub
https://github.com/retspen/webvirtmgr/issues/503#issuecomment-122729100.

<!-- gh-comment-id:122791054 --> @ITFactoryAUT commented on GitHub (Jul 20, 2015): The issue still exists on my server too. Still annoying and still no fix for that. On Jul 20, 2015 4:02 AM, "kkasberg" notifications@github.com wrote: > I am still having this issue. I get disconnected after 30 seconds. I am > not using a proxy or SSL. I checked that I have the changes suggested by > brenard, and I am still having the issue. Is this resolved for everyone > else? > > — > Reply to this email directly or view it on GitHub > https://github.com/retspen/webvirtmgr/issues/503#issuecomment-122729100.
Author
Owner

@pabbott0 commented on GitHub (Aug 2, 2015):

I had the same issue. Upgrading to Websockify 0.7.0 (which got release a few days ago) via pip seems to have fixed it for VNC over SSH. I have not tried Spice.

<!-- gh-comment-id:126998626 --> @pabbott0 commented on GitHub (Aug 2, 2015): I had the same issue. Upgrading to Websockify 0.7.0 (which got release a few days ago) via pip seems to have fixed it for VNC over SSH. I have not tried Spice.
Author
Owner

@GusevVictor commented on GitHub (Aug 6, 2015):

pabbott0, thank you! It looks like a good solution.

<!-- gh-comment-id:128450263 --> @GusevVictor commented on GitHub (Aug 6, 2015): pabbott0, thank you! It looks like a good solution.
Author
Owner

@pabbott0 commented on GitHub (Aug 6, 2015):

No prob :) And thanks to websockify for fixing the issue. After trying Spice, it didn't seem to work properly. Then again, I don't think I've ever had Spice actually work for me using novnc on any other virt management interface (like oVirt), so no big deal.

<!-- gh-comment-id:128456674 --> @pabbott0 commented on GitHub (Aug 6, 2015): No prob :) And thanks to websockify for fixing the issue. After trying Spice, it didn't seem to work properly. Then again, I don't think I've ever had Spice actually work for me using novnc on any other virt management interface (like oVirt), so no big deal.
Author
Owner

@kkasberg commented on GitHub (Aug 20, 2015):

I am still having it close after the 20 seconds. Is there anything that needs to be done after updating to Websockify 0.7.0?

<!-- gh-comment-id:133149254 --> @kkasberg commented on GitHub (Aug 20, 2015): I am still having it close after the 20 seconds. Is there anything that needs to be done after updating to Websockify 0.7.0?
Author
Owner

@ringwilling commented on GitHub (Sep 2, 2024):

I had the same issue too. Upgrading to Websockify 0.7.0via pip seems to have fixed it for VNC over SSH@pabbott0
thanks bro!

<!-- gh-comment-id:2323747335 --> @ringwilling commented on GitHub (Sep 2, 2024): I had the same issue too. Upgrading to Websockify 0.7.0via pip seems to have fixed it for VNC over SSH@pabbott0 thanks bro!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtmgr#373
No description provided.