diff -Nru websockify-0.6.1+dfsg1/debian/changelog websockify-0.6.1+dfsg1/debian/changelog --- websockify-0.6.1+dfsg1/debian/changelog 2015-07-17 22:39:23.000000000 +0900 +++ websockify-0.6.1+dfsg1/debian/changelog 2017-10-24 12:30:32.000000000 +0900 @@ -1,3 +1,12 @@ +websockify (0.6.1+dfsg1-1~cloud2) trusty-mitaka; urgency=medium + + * Fix hanging nova-novncproxy and can't be restarted (LP: #1715254) + - [PATCH] Make websockify respect SIGTERM + - [PATCH] Remove additional signal calls in websockify that + causes novnc to hang. + + -- Seyeong Kim Mon, 16 Oct 2017 19:08:41 +0900 + websockify (0.6.1+dfsg1-1~cloud1) trusty-liberty; urgency=medium * New update for the Ubuntu Cloud Archive. diff -Nru websockify-0.6.1+dfsg1/debian/patches/0001-Make-websockify-respect-SIGTERM.patch websockify-0.6.1+dfsg1/debian/patches/0001-Make-websockify-respect-SIGTERM.patch --- websockify-0.6.1+dfsg1/debian/patches/0001-Make-websockify-respect-SIGTERM.patch 1970-01-01 09:00:00.000000000 +0900 +++ websockify-0.6.1+dfsg1/debian/patches/0001-Make-websockify-respect-SIGTERM.patch 2017-10-24 12:31:54.000000000 +0900 @@ -0,0 +1,37 @@ +From 68b1587adafbd15fe47d8b7cd652073dbd06b25f Mon Sep 17 00:00:00 2001 +From: Abhishek Kekane +Date: Wed, 3 Feb 2016 22:58:21 -0800 +Subject: [PATCH] Make websockify respect SIGTERM + +Child processes were not terminated when the parent websockify +was killed. + +This commit makes websockify send a SIGTERM to all active children +when the parent process is terminated. + +Fixes #138 +--- + websockify/websocket.py | 8 ++++++++ + 1 file changed, 8 insertions(+) + +Origin: upstream, https://github.com/novnc/websockify/pull/226 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1715254 +Index: websockify-0.6.1+dfsg1/websockify/websocket.py +=================================================================== +--- websockify-0.6.1+dfsg1.orig/websockify/websocket.py ++++ websockify-0.6.1+dfsg1/websockify/websocket.py +@@ -1013,6 +1013,14 @@ class WebSocketServer(object): + + except (self.Terminate, SystemExit, KeyboardInterrupt): + self.msg("In exit") ++ # terminate all child processes ++ if multiprocessing and not self.run_once: ++ children = multiprocessing.active_children() ++ ++ for child in children: ++ self.msg("Terminating child %s" % child.pid) ++ child.terminate() ++ + break + except Exception: + self.msg("handler exception: %s", str(exc)) diff -Nru websockify-0.6.1+dfsg1/debian/patches/0001-Remove-additional-signal-calls-in-websockify-that-ca.patch websockify-0.6.1+dfsg1/debian/patches/0001-Remove-additional-signal-calls-in-websockify-that-ca.patch --- websockify-0.6.1+dfsg1/debian/patches/0001-Remove-additional-signal-calls-in-websockify-that-ca.patch 1970-01-01 09:00:00.000000000 +0900 +++ websockify-0.6.1+dfsg1/debian/patches/0001-Remove-additional-signal-calls-in-websockify-that-ca.patch 2017-10-24 12:32:16.000000000 +0900 @@ -0,0 +1,60 @@ +From 0c97f344a5eea76f5e339dc4b49ad578810282a4 Mon Sep 17 00:00:00 2001 +From: Aliasgar Ginwala +Date: Mon, 4 Jan 2016 18:04:26 -0800 +Subject: [PATCH] Remove additional signal calls in websockify that causes + novnc to hang. + +Openstack nova novnc-proxy services uses websockify to provide support +for nova vms using novnc proxy. At present, novnc hangs every couple of +weeks. It only resumes post restart of the novnc-proxy which is not +good. Hence, this code in websockify is updated to get rid of additional +signal calls to avoid novnc going in hang state even though process is +running. Basically, we are getting rid of existing msg and vmsg calls in +the websocket.py. This is kind of quick fix but we will need an +additional way of figuring out the logging to make it easy to trace in +case of any further failures in future. + +closes bug: https://github.com/kanaka/noVNC/issues/556 +--- + websockify/websocket.py | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +Origin: upstream, https://github.com/novnc/websockify/pull/217 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1715254 +Index: websockify-0.6.1+dfsg1/websockify/websocket.py +=================================================================== +--- websockify-0.6.1+dfsg1.orig/websockify/websocket.py ++++ websockify-0.6.1+dfsg1/websockify/websocket.py +@@ -848,11 +848,14 @@ class WebSocketServer(object): + raise self.Terminate() + + def multiprocessing_SIGCHLD(self, sig, stack): +- self.vmsg('Reaing zombies, active child count is %s', len(multiprocessing.active_children())) ++ # TODO: figure out a way to actually log this information without ++ # calling `log` in the signal handlers ++ multiprocessing.active_children() + + def fallback_SIGCHLD(self, sig, stack): + # Reap zombies when using os.fork() (python 2.4) +- self.vmsg("Got SIGCHLD, reaping zombies") ++ # TODO: figure out a way to actually log this information without ++ # calling `log` in the signal handlers + try: + result = os.waitpid(-1, os.WNOHANG) + while result[0]: +@@ -862,11 +865,13 @@ class WebSocketServer(object): + pass + + def do_SIGINT(self, sig, stack): +- self.msg("Got SIGINT, exiting") ++ # TODO: figure out a way to actually log this information without ++ # calling `log` in the signal handlers + self.terminate() + + def do_SIGTERM(self, sig, stack): +- self.msg("Got SIGTERM, exiting") ++ # TODO: figure out a way to actually log this information without ++ # calling `log` in the signal handlers + self.terminate() + + def top_new_client(self, startsock, address): diff -Nru websockify-0.6.1+dfsg1/debian/patches/series websockify-0.6.1+dfsg1/debian/patches/series --- websockify-0.6.1+dfsg1/debian/patches/series 2015-06-16 01:08:44.000000000 +0900 +++ websockify-0.6.1+dfsg1/debian/patches/series 2017-10-23 18:27:46.000000000 +0900 @@ -1,2 +1,4 @@ removes-websocket-swf-file.patch fixes-rebind-wrapper.patch +0001-Make-websockify-respect-SIGTERM.patch +0001-Remove-additional-signal-calls-in-websockify-that-ca.patch