[bst-1] Stack trace while removing device files, fuse related

As usual, this is almost impossible to reproduce.

Interestingly in this case we have two stack traces, one of them is incomplete because it's overwritten by the status area, and the remainder is properly delivered through the logging mechanism:

fusermount: failed to access mountpoint /home/tristan/.cache/buildstream/build/apps-lightsoff-l4dzm2ki/scratch/_/mount: Permission denied
Process Process-358:4:
Traceback (most recent call last):
  File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/codethink/GNOME/buildstream/buildstream/_fuse/mount.py", line 187, in __run_fuse
[00:01:20][44fe0704][build:apps/lightsoff.bst            ] BUG     gnome/apps-lightsoff/44fe0704-build.7666.log

    An unhandled exception occured:
    
    Traceback (most recent call last):
      File "/codethink/GNOME/buildstream/buildstream/_scheduler/job.py", line 265, in child_action
        result = self.action(element)
      File "/codethink/GNOME/buildstream/buildstream/_scheduler/buildqueue.py", line 34, in process
        element._assemble()
      File "/codethink/GNOME/buildstream/buildstream/element.py", line 1092, in _assemble
        self.stage(sandbox)
      File "/codethink/GNOME/buildstream/buildstream/buildelement.py", line 174, in stage
        dep.integrate(sandbox)
      File "/codethink/GNOME/buildstream/buildstream/element.py", line 484, in integrate
        exitcode = sandbox.run(['sh', '-e', '-c', cmd], 0, env=environment, cwd='/')
      File "/codethink/GNOME/buildstream/buildstream/sandbox/_sandboxbwrap.py", line 179, in run
        self.try_remove_device(device_path)
      File "/codethink/GNOME/buildstream/buildstream/sandbox/_sandboxbwrap.py", line 342, in try_remove_device
        os.unlink(device_path)
    OSError: [Errno 107] Transport endpoint is not connected: '/home/tristan/.cache/buildstream/build/apps-lightsoff-l4dzm2ki/scratch/_/mount/dev/full'

It looks like the first overwritten stack trace is not from the main process, but from the fuse subprocess.

Edited by Tristan Van Berkom