Unhandled exception when terminating failed build

Summary

When terminating after a failed build i received an unhandled exception

Steps to reproduce

This happened after viewing the logs for a few minutes, then exiting the logs and trying to terminate the build.

What is the current bug behavior?

Stack trace is produced on termination of a job

What is the expected correct behavior?

No stack trace just terminate the job

Relevant logs and/or screenshots

Choice: [continue]: t

Terminating all jobs

[--:--:--][7cbdafe1][ main:base/libflac.bst              ] STATUS  Fetch terminating
[--:--:--][62825e9e][ main:desktop/xorg-lib-pciaccess.bst] STATUS  Build terminating
[--:--:--][5980a1fe][ main:base/m4.bst                   ] STATUS  Build terminating
[--:--:--][7a4e867d][ main:base/util-linux.bst           ] STATUS  Build terminating
[--:--:--][18dd4527][ main:desktop/xorg-lib-xtrans.bst   ] STATUS  Build terminating
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/psutil/_pslinux.py", line 1459, in wrapper
    return fun(self, *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/psutil/_pslinux.py", line 1641, in create_time
    values = self._parse_stat_file()
  File "/usr/lib/python3.7/site-packages/psutil/_common.py", line 340, in wrapper
    return fun(self)
  File "/usr/lib/python3.7/site-packages/psutil/_pslinux.py", line 1498, in _parse_stat_file
    with open_binary("%s/%s/stat" % (self._procfs_path, self.pid)) as f:
  File "/usr/lib/python3.7/site-packages/psutil/_pslinux.py", line 205, in open_binary
    return open(fname, "rb", **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: '/proc/30508/stat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/psutil/__init__.py", line 366, in _init
    self.create_time()
  File "/usr/lib/python3.7/site-packages/psutil/__init__.py", line 697, in create_time
    self._create_time = self._proc.create_time()
  File "/usr/lib/python3.7/site-packages/psutil/_pslinux.py", line 1470, in wrapper
    raise NoSuchProcess(self.pid, self._name)
psutil._exceptions.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=30508)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/adds68/.local/lib/python3.7/site-packages/buildstream/_signals.py", line 40, in terminator_handler
    terminator_()
  File "/home/adds68/.local/lib/python3.7/site-packages/buildstream/sandbox/_sandboxbwrap.py", line 289, in terminate_bwrap
    user_proc = get_user_proc(process.pid)
  File "/home/adds68/.local/lib/python3.7/site-packages/buildstream/sandbox/_sandboxbwrap.py", line 276, in get_user_proc
    bwrap_proc = psutil.Process(bwrap_pid)
  File "/usr/lib/python3.7/site-packages/psutil/__init__.py", line 339, in __init__
    self._init(pid)
  File "/usr/lib/python3.7/site-packages/psutil/__init__.py", line 379, in _init
    raise NoSuchProcess(pid, None, msg)
psutil._exceptions.NoSuchProcess: psutil.NoSuchProcess no process found with pid 30508
Error encountered in BuildStream while processing custom SIGTERM handler: <function SandboxBwrap.run_bwrap.<locals>.terminate_bwrap at 0x7f77952c19d8>
Traceback (most recent call last):
  File "/home/adds68/.local/lib/python3.7/site-packages/buildstream/_signals.py", line 40, in terminator_handler
    terminator_()
  File "/home/adds68/.local/lib/python3.7/site-packages/buildstream/sandbox/_sandboxbwrap.py", line 288, in terminate_bwrap
    if process:
NameError: free variable 'process' referenced before assignment in enclosing scope
Error encountered in BuildStream while processing custom SIGTERM handler: <function SandboxBwrap.run_bwrap.<locals>.terminate_bwrap at 0x7f77951f7a60>
Unknown child process pid 29920, will report returncode 255
Unknown child process pid 30441, will report returncode 255
Unknown child process pid 30442, will report returncode 255
Unknown child process pid 30443, will report returncode 255
Unknown child process pid 31379, will report returncode 255

User interrupted with ^C

Possible fixes

Other relevant information

  • BuildStream version affected: /milestone %BuildStream_v1.1.7