From ecafefb6851ec37d8e97fb40365fd79dad7b7119 Mon Sep 17 00:00:00 2001 From: pongtawat Date: Mon, 26 Dec 2016 17:50:50 +0700 Subject: [PATCH] Bug 17814: koha-plack --stop should make sure that Plack really stop MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit koha-plack --stop doesn't ensure that Plack was really stopped before returning So in case that koha-plack --stop was quickly follows by koha-plack --start (e.g. logrotate), it could leave Plack in stop state. This is due to koha-plack --start think that Plack was already started, while it actually is being stopped. For me I think this is the cause why I got random Plack stop when logrotate is run. It should be similar to the case of Zebra in Bug #16885, and the solution might be the same: adding "--retry=TERM/30/KILL/5;" to start-stop-daemon command. TEST PLAN --------- 1) Login to staff client and do something that will hold connection for a long time, e.g. a batch import or a slow report. 2) sudo koha-plack --stop mykoha 3) ps aux | grep plack <-- a Plack process will still running work in 1) 4) wait for 1) to finish and all Plack processes exit 5) sudo koha-plack --start mykoha 6) apply the patch 7) repeat step 1)-2) 8) ps aux | grep plack <-- There should be no Plack process running now 9) Note that work in step 1) might get terminated midway. Since we force Plack to stop after some wait. Signed-off-by: Marc Véron Signed-off-by: Jonathan Druart Signed-off-by: Mason James (cherry picked from commit b63f1c8b6ebfa24ae70745da7393cb1f15637dd4) Signed-off-by: Julian Maurice --- debian/scripts/koha-plack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index 229f0596f6..0d49c937f2 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -110,7 +110,7 @@ stop_plack() log_daemon_msg "Stopping Plack daemon for ${instancename}" - if start-stop-daemon --pidfile ${PIDFILE} --stop; then + if start-stop-daemon --pidfile ${PIDFILE} --stop --retry=TERM/30/KILL/5; then log_end_msg 0 else log_end_msg 1 -- 2.39.5