From dfd0cc9d1e012ebc73f65e1e42dd5b5028e24cd9 Mon Sep 17 00:00:00 2001 From: Idan Hefetz Date: Sun, 2 Jun 2019 11:15:23 +0000 Subject: [PATCH] Instantiate logger per process. Using the logger instance that was created by the master process, caused deadlocks by processes trying to write log messages. This is here solved, by instantiating only after child process starts. Change-Id: I57384fa970c15f78bee67851da089db4731ccbf8 Story: 2005817 Task: 33561 --- vitrage/entity_graph/workers.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vitrage/entity_graph/workers.py b/vitrage/entity_graph/workers.py index 4546348eb..4c77bb04a 100644 --- a/vitrage/entity_graph/workers.py +++ b/vitrage/entity_graph/workers.py @@ -45,7 +45,7 @@ from vitrage import messaging from vitrage import rpc as vitrage_rpc from vitrage import storage -LOG = log.getLogger(__name__) +LOG = None # Supported message types WAIT_FOR_WORKER_START = 'wait_for_worker_start' @@ -163,8 +163,10 @@ class GraphWorkersManager(cotyledon.ServiceManager): So that new/deleted templates are added/removed """ - LOG.info("Worker processes - starting...") self._submit_and_wait(self._all_queues, (WAIT_FOR_WORKER_START,)) + global LOG + if not LOG: + LOG = log.getLogger(__name__) LOG.info("Worker processes - ready!") def submit_template_event(self, event): @@ -232,6 +234,9 @@ class GraphCloneWorkerBase(coord.Service): raise NotImplementedError def run(self): + global LOG + if not LOG: + LOG = log.getLogger(__name__) super(GraphCloneWorkerBase, self).run() self._entity_graph.notifier._subscriptions = [] # Quick n dirty self._init_instance()