toaster: log ProcessLookupError in test_runbuilds
PATCH 1/1 toaster: log ProcessLookupError in test_runbuilds
This repeatably fails:
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File ".../poky/bitbake/lib/toaster/tests/commands/test_runbuilds.py", line 39, in run
os.kill(int(pid), signal.SIGTERM)
ProcessLookupError: [Errno 3] No such process
Rather than have a hard error, add logging and output as a warning.
--- lib/toaster/tests/commands/test_runbuilds.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
lib/toaster/tests/commands/test_runbuilds.py +9 -2
@@ -19,6 +19,10 @@ import time import subprocess import signal +import logging + +logger = logging.getLogger("toaster") + class KillRunbuilds(threading.Thread): """ Kill the runbuilds process after an amount of time """
@@ -36,8 +40,11 @@ class KillRunbuilds(threading.Thread): with open(pidfile_path) as pidfile: pid = pidfile.read() - os.kill(int(pid), signal.SIGTERM) - + try: + os.kill(int(pid), signal.SIGTERM) + except ProcessLookupError as err: + logger.warning("Failed to kill pid. %s" % err) + pass class TestCommands(TestCase): """ Sanity test that runbuilds executes OK """
Signature · 1 line
2.34.1
Quoted 34 lines · Tim Orling
This repeatably fails:
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in_bootstrap_innerself.run()File "
.../poky/bitbake/lib/toaster/tests/commands/test_runbuilds.py", line 39, in run
os.kill(int(pid), signal.SIGTERM)
ProcessLookupError: [Errno 3] No such processRather than have a hard error, add logging and output as a warning.
Signed-off-by Tim Orling <[email protected]>--- lib/toaster/tests/commands/test_runbuilds.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)lib/toaster/tests/commands/test_runbuilds.py +4
-0@@ -19,6 +19,10 @@ import time import subprocess import signal +import logging + +logger = logging.getLogger("toaster") + class KillRunbuilds(threading.Thread): """ Kill the runbuilds process after an amount of time """@@ -36,8 +40,11 @@ class KillRunbuilds(threading.Thread):
lib/toaster/tests/commands/test_runbuilds.py class KillRunbuilds(threading.Thread): · line 48
Quoted 10 lines
lib/toaster/tests/commands/test_runbuilds.py +5
-2with open(pidfile_path) as pidfile: pid = pidfile.read() - os.kill(int(pid), signal.SIGTERM) - + try: + os.kill(int(pid), signal.SIGTERM) + except ProcessLookupError as err: + logger.warning("Failed to kill pid. %s" % err) + pass
Is this a case of "just ensure bitbake has really exited"? If so we perhaps don't need the warning as it is quite likely it has exited?
Cheers,
Richard
Ignore this patch. More analysis is required.
Quoted 37 lines · Richard Purdie
Quoted 7 lines · Tim Orling
This repeatably fails:
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in_bootstrap_innerself.run()File "
.../poky/bitbake/lib/toaster/tests/commands/test_runbuilds.py",line 39, in run
Review
Quoted 11 lines
os.kill(int(pid), signal.SIGTERM)
ProcessLookupError: [Errno 3] No such processRather than have a hard error, add logging and output as a warning.
Signed-off-by Tim Orling <[email protected]>--- lib/toaster/tests/commands/test_runbuilds.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/lib/toaster/tests/commands/test_runbuilds.pyQuoted 16 lines
index
c77d6cf4..14b35764100644lib/toaster/tests/commands/test_runbuilds.py +4
-0@@ -19,6 +19,10 @@ import time import subprocess import signal +import logging + +logger = logging.getLogger("toaster") + class KillRunbuilds(threading.Thread): """ Kill the runbuilds process after an amount of time """@@ -36,8 +40,11 @@ class KillRunbuilds(threading.Thread):
Quoted 15 lines
lib/toaster/tests/commands/test_runbuilds.py class KillRunbuilds(threading.Thread): · line 48
Quoted 10 lines
lib/toaster/tests/commands/test_runbuilds.py +5
-2with open(pidfile_path) as pidfile: pid = pidfile.read() - os.kill(int(pid), signal.SIGTERM) - + try: + os.kill(int(pid), signal.SIGTERM) + except ProcessLookupError as err: + logger.warning("Failed to kill pid. %s" % err) + passIs this a case of "just ensure bitbake has really exited"? If so we perhaps don't need the warning as it is quite likely it has exited?
When Toaster starts, the .runbuild.pid file is created in the $BUILDDIR. Manually running 'manage.py runbuilds' should leave a process running. My suspicion is the path to .runbuilds.pid is somehow getting mangled or a stale, old .runbuilds.pid is sticking around. Something is wonky in the test environment.
Quoted 5 lines
Cheers,
Richard