diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2018-04-09 16:05:23 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-04-12 13:25:25 +0000 |
commit | e3e726168c0a62875b04af543515aeb2f60dfc09 (patch) | |
tree | bd8d8cdecbdf1f5e494bc6b38b33e2f21c5dc157 /buildstream/_fuse | |
parent | 337fc9654ece6d9a38ef9666ce11686828893cee (diff) | |
download | buildstream-e3e726168c0a62875b04af543515aeb2f60dfc09.tar.gz |
mount: Wrap yields in context managers with try-finally
The terminator context will only clean up on a signal,
so if another exception causes context manager cleanup
then unmount won't be called unless it's part of another context manager
or is wrapped in a try block's except or finally.
Everywhere else's unmounts are handled by delegating to another context manager
but these were what needed to be fixed.
The change in buildstream/_fuse/mount.py would cause lockups
since the build worker process still having a subprocess
blocked its termination from completing
which in turn caused the pipeline manager process to block indefinitely on it.
Diffstat (limited to 'buildstream/_fuse')
-rw-r--r-- | buildstream/_fuse/mount.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/buildstream/_fuse/mount.py b/buildstream/_fuse/mount.py index 8220a8d07..3848ad305 100644 --- a/buildstream/_fuse/mount.py +++ b/buildstream/_fuse/mount.py @@ -143,12 +143,11 @@ class Mount(): @contextmanager def mounted(self, mountpoint): - def kill_proc(): - self.unmount() - - with _signals.terminator(kill_proc): - self.mount(mountpoint) - yield + self.mount(mountpoint) + try: + with _signals.terminator(self.unmount): + yield + finally: self.unmount() ################################################ |