From 363498b8826c20da956eccab4a3dc62d062dbbab Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 28 Sep 2020 09:24:36 -0400 Subject: [PATCH] Disable SIGINT handling in child processes There seems to be no good reason not too since our cancellation machinery/protocol should do this work when the root receives the signal. This also (hopefully) helps with some debugging race condition stuff. --- tractor/_entry.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tractor/_entry.py b/tractor/_entry.py index 71dfdec..9099fc0 100644 --- a/tractor/_entry.py +++ b/tractor/_entry.py @@ -3,6 +3,7 @@ Process entry points. """ from functools import partial from typing import Tuple, Any +import signal import trio # type: ignore @@ -57,6 +58,10 @@ def _trio_main( ) -> None: """Entry point for a `trio_run_in_process` subactor. """ + # Disable sigint handling in children; + # we don't need it thanks to our cancellation machinery. + signal.signal(signal.SIGINT, signal.SIG_IGN) + # TODO: make a global func to set this or is it too hacky? # os.environ['PYTHONBREAKPOINT'] = 'tractor._debug.breakpoint'