From 9839e6781c1a21bcb0fdefcafc8229e9f2474522 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 6 Aug 2019 04:36:17 +0100 Subject: [PATCH] core: more descriptive graceful shutdown timeout error Accounts for timers too Tidy up a wordy comment further down the file --- mitogen/core.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index 96c30fb0..9a863078 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -3333,10 +3333,10 @@ class Broker(object): self._loop_once(max(0, deadline - time.time())) if self.keep_alive(): - LOG.error('%r: some streams did not close gracefully. ' - 'The most likely cause for this is one or ' - 'more child processes still connected to ' - 'our stdout/stderr pipes.', self) + LOG.error('%r: pending work still existed %d seconds after ' + 'shutdown began. This may be due to a timer that is yet ' + 'to expire, or a child connection that did not fully ' + 'shut down.', self, self.shutdown_timeout) def _do_broker_main(self): """ @@ -3511,11 +3511,11 @@ class ExternalContext(object): if not self.config['profiling']: os.kill(os.getpid(), signal.SIGTERM) - #: On Python >3.4, the global importer lock has been sharded into a - #: per-module lock, meaning there is no guarantee the import statement in - #: service_stub_main will be truly complete before a second thread - #: attempting the same import will see a partially initialized module. - #: Sigh. Therefore serialize execution of the stub itself. + #: On Python >3.4, the global importer lock has split into per-module + #: locks, so there is no guarantee the import statement in + #: service_stub_main will complete before a second thread attempting the + #: same import will see a partially initialized module. Therefore serialize + #: the stub explicitly. service_stub_lock = threading.Lock() def _service_stub_main(self, msg):