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 18:18:14 +0000
commita71bbed8ed4fb7c8a75d14299dbb4c0540e0fb25 (patch)
tree4f3e5ded45788bae493af51231232cbcfd554b7f
parentad08ad267f074f73c2f895099fd659e27d0d194c (diff)
downloadbuildstream-a71bbed8ed4fb7c8a75d14299dbb4c0540e0fb25.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: