qemurunner.py: add try/except for pid handling race
PATCH 1/1 qemurunner.py: add try/except for pid handling race
In some instances, attempts to remove the qemu pidfile within the stop() method fail despite the os.path.exists() call immediately before implying that the file is present. Add a try/except block to log a warning if this occurs, rather than failing outright, since the process simply appears to be exiting at an inconvenient time.
Signed-off-by Trevor Gamblin <[email protected]>
--- meta/lib/oeqa/utils/qemurunner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
meta/lib/oeqa/utils/qemurunner.py +4 -1
@@ -406,7 +406,10 @@ class QemuRunner: self.qemupid = None self.ip = None if os.path.exists(self.qemu_pidfile): - os.remove(self.qemu_pidfile) + try: + os.remove(self.qemu_pidfile) + except FileNotFoundError as e: + self.logger.warning('qemu pidfile is no longer present') if self.monitorpipe: self.monitorpipe.close()
Signature · 1 line
2.24.1