diff options
| author | Yoann Congal <yoann.congal@smile.fr> | 2024-02-29 22:56:39 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-03-03 16:26:17 +0000 |
| commit | ef88dee4f77ca95ec79e62d08fc0a01e83528e11 (patch) | |
| tree | 6e4ae1e94ad47baa54ce841f828645b408feab6c | |
| parent | 2689d8cf22d3809923aad5bd87e5e3e1821ffc82 (diff) | |
| download | poky-ef88dee4f77ca95ec79e62d08fc0a01e83528e11.tar.gz | |
bitbake: prserv/serv: Fix a PID file removal race on prserv stop
A race condition has happened where the exiting server removed the PID
file between the existence check and the removal, resulting in a
FileNotFoundError exception.
The fix is to ignore the FileNotFoundError exception, the existence
check is now redundant so remove it to simplify.
Fixes [YOCTO #14341]
(Bitbake rev: 40d00bf9308e0bf73a00134a99a012a292daa1c5)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/prserv/serv.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py index 62d3b5a01c..5fc8863f70 100644 --- a/bitbake/lib/prserv/serv.py +++ b/bitbake/lib/prserv/serv.py | |||
| @@ -262,8 +262,11 @@ def stop_daemon(host, port): | |||
| 262 | os.kill(pid, signal.SIGTERM) | 262 | os.kill(pid, signal.SIGTERM) |
| 263 | time.sleep(0.1) | 263 | time.sleep(0.1) |
| 264 | 264 | ||
| 265 | if os.path.exists(pidfile): | 265 | try: |
| 266 | os.remove(pidfile) | 266 | os.remove(pidfile) |
| 267 | except FileNotFoundError: | ||
| 268 | # The PID file might have been removed by the exiting process | ||
| 269 | pass | ||
| 267 | 270 | ||
| 268 | except OSError as e: | 271 | except OSError as e: |
| 269 | err = str(e) | 272 | err = str(e) |
