From 3b585b841e6602aa2366564040507261d4a5d68c Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 24 Feb 2019 20:12:51 +0000 Subject: [PATCH] core: ensure 'exit' signal fires even on Broker crash. --- mitogen/core.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index f850def9..843f5a04 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -3272,8 +3272,11 @@ class Broker(object): self._broker_exit() def _broker_main(self): - _profile_hook('mitogen.broker', self._do_broker_main) - fire(self, 'exit') + try: + _profile_hook('mitogen.broker', self._do_broker_main) + finally: + # 'finally' to ensure _on_broker_exit() can always SIGTERM. + fire(self, 'exit') def shutdown(self): """