mirror of
https://git.yoctoproject.org/poky
synced 2026-03-06 23:39:40 +01:00
oeqa/qemurunner: Handle rare shutdown race
The pid file can disappear when qemu is shutting down leading to a file not found race before it is read. Tweak the code to handle this and fix a rare but annoying race error case. [YOCTO #15036] (From OE-Core rev: 8c07aac9d55f92fe5fbe3cab9f006efecf266328) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -630,8 +630,12 @@ class QemuRunner:
|
||||
# so it's possible that the file has been created but the content is empty
|
||||
pidfile_timeout = time.time() + 3
|
||||
while time.time() < pidfile_timeout:
|
||||
with open(self.qemu_pidfile, 'r') as f:
|
||||
qemu_pid = f.read().strip()
|
||||
try:
|
||||
with open(self.qemu_pidfile, 'r') as f:
|
||||
qemu_pid = f.read().strip()
|
||||
except FileNotFoundError:
|
||||
# Can be used to detect shutdown so the pid file can disappear
|
||||
return False
|
||||
# file created but not yet written contents
|
||||
if not qemu_pid:
|
||||
time.sleep(0.5)
|
||||
|
||||
Reference in New Issue
Block a user