diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2018-09-07 12:06:34 -0400 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-09-10 15:43:53 +0100 |
commit | 5d6228b85e174dee8abcc4c206a1e9034242c6c6 (patch) | |
tree | b0a604f4323d6a85472635556f66700e612fcb98 | |
parent | d9810206cb4d56825ed4de98b6ae636461d59bbd (diff) | |
download | sos-5d6228b85e174dee8abcc4c206a1e9034242c6c6.tar.gz |
[sosreport] ensure ThreadPool exceptions are raised
The ThreadPoolExecutor does not raise exceptions to the parent
thread immediately: it stores them in-line in the pool's results
list, and raises them to the caller on acccess to that slot in
the results iterator.
Make sure that these exceptions are handled by iterating over all
results and asserting that they are non-None (in practice, this
code is never executed since the resulting raise will trap to an
exception handler, but it is less confusing than a bare 'pass').
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/sosreport.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py index 80633966..44be75a1 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -1065,9 +1065,13 @@ class SoSReport(object): try: self.plugpool = ThreadPoolExecutor(self.opts.threads) # Pass the plugpool its own private copy of self.pluglist - self.plugpool.map(self._collect_plugin, list(self.pluglist), - chunksize=1) + results = self.plugpool.map(self._collect_plugin, + list(self.pluglist), chunksize=1) self.plugpool.shutdown(wait=True) + for res in results: + if not res: + self.soslog.debug("Unexpected plugin task result: %s" % + res) self.ui_log.info("") except KeyboardInterrupt: # We may not be at a newline when the user issues Ctrl-C |