From 79103bd1005c295f8948d2eba7ba71c8135066eb Mon Sep 17 00:00:00 2001 From: Krzysztof Godlewski Date: Thu, 17 Oct 2024 10:21:52 +0200 Subject: [PATCH] Check if SyncProcess is alive in SIGCHLD handler. This is enough to decide if SIGCHLD is signalling our SyncProcess termination, or some other spawned child. --- src/neptune_scale/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/neptune_scale/__init__.py b/src/neptune_scale/__init__.py index 2bc91f16..8b63c5de 100644 --- a/src/neptune_scale/__init__.py +++ b/src/neptune_scale/__init__.py @@ -273,6 +273,10 @@ def __init__( self.wait_for_processing(verbose=False) def _handle_signal(self, signum: int, frame: Any) -> None: + # We should not be concerned about SIGCHLD if it's not about our child process + if signum == signal.SIGCHLD and self._sync_process.is_alive(): + return + if not self._is_closing: signame = safe_signal_name(signum) logger.debug(f"Received signal {signame}. Terminating.")