From 44d36eccbad4301cbb26ebaac10dc015ef3301c8 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 16 Mar 2018 01:13:02 +0545 Subject: [PATCH] issue #146: don't crash during on_broker_shutdown There is some insane unidentifiable Mitogen context (the local context?) that instantly crashes with a higher forks setting. It appears to be harmless, but meanwhile this naturally shouldn't be happening. --- mitogen/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mitogen/core.py b/mitogen/core.py index 93d621f0..a132c170 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -531,6 +531,9 @@ class Importer(object): os.environ['PBR_VERSION'] = '0.0.0' def _on_load_module(self, msg): + if msg == _DEAD: + return + tup = msg.unpickle() fullname = tup[0] _v and LOG.debug('Importer._on_load_module(%r)', fullname) @@ -1285,7 +1288,7 @@ class ExternalContext(object): def _on_shutdown_msg(self, msg): _v and LOG.debug('_on_shutdown_msg(%r)', msg) - if msg.src_id != mitogen.parent_id: + if msg != _DEAD and msg.src_id != mitogen.parent_id: LOG.warning('Ignoring SHUTDOWN from non-parent: %r', msg) return self.broker.shutdown()