From bf32dbf66aea9ce59828cbd7f35ec036fa5cbdb2 Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Thu, 19 May 2016 12:26:24 -0400 Subject: [PATCH] kill by default with SIGKILL if SIGTERM didn't work. Also, always remove the PID file on SIGKILL --- blockstack/blockstackd.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/blockstack/blockstackd.py b/blockstack/blockstackd.py index d7e4adb8c..d7c7bb13c 100644 --- a/blockstack/blockstackd.py +++ b/blockstack/blockstackd.py @@ -1765,7 +1765,10 @@ def stop_server( clean=False, kill=False ): sys.exit(1) if kill: - time.sleep(3.0) + clean = True + timeout = 5.0 + log.info("Waiting %s seconds before sending SIGKILL to %s" % pid) + time.sleep(timeout) try: os.kill(pid, signal.SIGKILL) except Exception, e: @@ -1848,7 +1851,7 @@ def blockstack_exit(): """ Shut down the server on exit(3) """ - stop_server() + stop_server(kill=True) def blockstack_exit_handler( sig, frame ): @@ -2757,7 +2760,7 @@ def run_blockstackd(): log.info("Service endpoint exited with status code %s" % exit_status ) elif args.action == 'stop': - stop_server() + stop_server(kill=True) elif args.action == 'reconfigure': reconfigure( testset=testset )