From ad19bd6239973096cf5fc5410a7a3c8d6f6cd60f Mon Sep 17 00:00:00 2001 From: Filipp Ozinov Date: Mon, 9 Jun 2025 10:56:17 +0400 Subject: [PATCH] Fix for zombie processes --- mysql_ch_replicator/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mysql_ch_replicator/utils.py b/mysql_ch_replicator/utils.py index cba8f5c..77338ba 100644 --- a/mysql_ch_replicator/utils.py +++ b/mysql_ch_replicator/utils.py @@ -45,11 +45,15 @@ def restart_dead_process_if_required(self): logger.warning(f'Restarting stopped process: < {self.cmd} >') self.run() return + res = self.process.poll() if res is None: - # still running + # Process is running fine. return - logger.warning(f'Restarting dead process: < {self.cmd} >') + + logger.warning(f'Process dead (exit code: {res}), restarting: < {self.cmd} >') + # Process has already terminated, just reap it + self.process.wait() self.run() def stop(self):