From 611e0edd80a7109dba1cc3eb76fdac9d3872f191 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 12 Apr 2020 03:49:29 -0400 Subject: [PATCH] Reorder last keepalive during cleanup Make sure the stopping of the keepalive timer and final keepalive update are done as the last step before complete shutdown. The previous setup could conceivably result in a node being fenced should the cleanup operations take longer than ~45 seconds, for instance if primary node switchover took too long or blocked, or log watchers failed to stop quickly enough. Ensures that keepalives will continue to be run during the shutdown process until the last possible moment. --- node-daemon/pvcnoded/Daemon.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/node-daemon/pvcnoded/Daemon.py b/node-daemon/pvcnoded/Daemon.py index 57a2d83f..7184c22f 100644 --- a/node-daemon/pvcnoded/Daemon.py +++ b/node-daemon/pvcnoded/Daemon.py @@ -557,17 +557,6 @@ def cleanup(): while this_node.flush_thread is not None: time.sleep(0.5) - logger.out('Performing final keepalive update', state='s') - update_zookeeper() - - # Stop keepalive thread - try: - stopKeepaliveTimer() - except NameError: - pass - except AttributeError: - pass - # Stop console logging on all VMs logger.out('Stopping domain console watchers', state='s') for domain in d_domain: @@ -592,6 +581,17 @@ def cleanup(): except: pass + # Stop keepalive thread + try: + stopKeepaliveTimer() + except NameError: + pass + except AttributeError: + pass + + logger.out('Performing final keepalive update', state='s') + update_zookeeper() + # Set stop state in Zookeeper zkhandler.writedata(zk_conn, { '/nodes/{}/daemonstate'.format(myhostname): 'stop' })