diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-26 22:52:26 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-30 15:15:26 +0000 |
commit | 8c07aac9d55f92fe5fbe3cab9f006efecf266328 (patch) | |
tree | 0340c83342eab5df57cf93476101b3cd48aee9e3 /meta | |
parent | 952c94988cf1cf093668e9ac7020485c51cf3a58 (diff) | |
download | openembedded-core-8c07aac9d55f92fe5fbe3cab9f006efecf266328.tar.gz |
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]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 7273bbc3db..277cd32848 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py @@ -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) |