From b77ed8dbffe7d879d4d7dc32e127b41d6a695842 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 10 Oct 2018 13:07:27 -0400 Subject: [PATCH] Fix config sync on dead writer The sync thread can die without clearing syncrunning. Make sure that the thread is alive *and* that the thread has not indicated intent to give up. --- confluent_server/confluent/collective/manager.py | 2 +- confluent_server/confluent/config/configmanager.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/collective/manager.py b/confluent_server/confluent/collective/manager.py index 09961698..e8092529 100644 --- a/confluent_server/confluent/collective/manager.py +++ b/confluent_server/confluent/collective/manager.py @@ -82,7 +82,7 @@ def connect_to_leader(cert=None, name=None, leader=None): log.log({ 'info': 'Collective initialization in progress on ' '{0}, will retry connection'.format(leader), - 'subsystem': 'collective'}) + 'subsystem': 'collective'}) ####### bad idea? eventlet.spawn_after(random.random(), connect_to_leader, cert, name, leader) return True diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index bc114426..477c9104 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -2061,7 +2061,8 @@ class ConfigManager(object): if statelessmode: return with cls._syncstate: - if cls._syncrunning: + if (cls._syncrunning and cls._cfgwriter is not None and + cls._cfgwriter.isAlive()): cls._writepending = True return cls._syncrunning = True