summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-11 12:13:32 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-11 17:33:35 +0000
commitc1d76235d919f02927851db489adfa0c61ab97ff (patch)
treed3126c7df22fc8e6ee2261229500dd05e3c8874e
parentbc931312f965030908d51a7e9a94a4d4ee31c0d3 (diff)
downloadbuildstream-c1d76235d919f02927851db489adfa0c61ab97ff.tar.gz
_artifactcache/ostreecache.py: Subprocesses should not return exceptions
We have a policy that subprocesses can return error messages, but not actual exceptions. In particular this allows GLib.Error exceptions to be returned, which would otherwise be silently lost due to https://gitlab.gnome.org/GNOME/pygobject/issues/145
-rw-r--r--buildstream/_artifactcache/ostreecache.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/buildstream/_artifactcache/ostreecache.py b/buildstream/_artifactcache/ostreecache.py
index 5dd0339d8..ea109f308 100644
--- a/buildstream/_artifactcache/ostreecache.py
+++ b/buildstream/_artifactcache/ostreecache.py
@@ -372,11 +372,7 @@ class OSTreeCache(ArtifactCache):
remote_refs = _ostree.list_remote_refs(self.repo, remote=remote)
q.put((None, push_url, pull_url, remote_refs))
except Exception as e:
- # Exceptions aren't automatically propagated by
- # multiprocessing, so we catch everything here. Note that
- # GLib.Error subclasses can't be returned (as they don't
- # 'pickle') and so they'll be ignored.
- q.put((e, None, None, None))
+ q.put((str(e), None, None, None))
# Kick off all the initialization jobs one by one.
#
@@ -393,16 +389,16 @@ class OSTreeCache(ArtifactCache):
with _signals.blocked([signal.SIGINT], ignore=False):
p.start()
- exception, push_url, pull_url, remote_refs = q.get()
+ error, push_url, pull_url, remote_refs = q.get()
p.join()
except KeyboardInterrupt:
utils._kill_process_tree(p.pid)
raise
- if exception and on_failure:
- on_failure(remote.url, exception)
- elif exception:
- raise ArtifactError() from exception
+ if error and on_failure:
+ on_failure(remote.url, error)
+ elif error:
+ raise ArtifactError(error)
else:
if remote.push:
if push_url: