Bug 14341

Summary: BitbakePrTests.test_stopping_prservice_message fails
Product: [QA/Testing] Functional (self) Testing Reporter: Alejandro <alejandro>
Component: oe-selftestAssignee: Yoann Congal <yoann.congal>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: alexandre.belloni, randy.macleod, yoann.congal
Version: unspecified   
Target Milestone: 5.0   
Hardware: x86   
OS: Multiple   
Whiteboard: AB-INT AB-HAVE-PLAN
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Alejandro 2021-04-07 18:23:21 UTC
The PR server stop command was unsuccessful since the pid tmp file doesnt exist:

AssertionError: Command 'bitbake-prserv --host localhost --port 34207 --loglevel=DEBUG --stop' returned non-zero exit status 1:
Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-ubuntu/build/bitbake/bin/bitbake-prserv", line 53, in <module>
    ret = main()
  File "/home/pokybuild/yocto-worker/oe-selftest-ubuntu/build/bitbake/bin/bitbake-prserv", line 46, in main
    ret=prserv.serv.stop_daemon(options.host, options.port)
  File "/home/pokybuild/yocto-worker/oe-selftest-ubuntu/build/bitbake/lib/prserv/serv.py", line 426, in stop_daemon
    raise e
  File "/home/pokybuild/yocto-worker/oe-selftest-ubuntu/build/bitbake/lib/prserv/serv.py", line 421, in stop_daemon
    os.remove(pidfile)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/PRServer_127.0.0.1_34207.pid'
Waiting for pr-server to exit.
Sending SIGTERM to pr-server.

More details at:
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/2002/steps/14/logs/stdio
Comment 1 Randy MacLeod 2021-04-08 14:55:21 UTC
Looks like a shutdown race condition.
Comment 2 Randy MacLeod 2021-10-21 14:58:20 UTC
We think this is a race that we should keep looking for an fix.
Comment 3 Randy MacLeod 2023-10-30 15:37:32 UTC
Build move to 5.0 -- ../Randy
Comment 4 Yoann Congal 2024-02-22 16:19:43 UTC
Transcribing Richard's comment during the triage meeting:
https://git.yoctoproject.org/poky/tree/bitbake/lib/prserv/serv.py#n265:
        if os.path.exists(pidfile):
            os.remove(pidfile)
=> pidfile might be removed by the exiting process between those 2 lines and trigger the FileNotFoundError exception

A fix might be to encase the os.remove in a try/except to ignore silently this case.
Comment 5 Yoann Congal 2024-02-29 21:58:10 UTC
Patch sent : https://lists.openembedded.org/g/bitbake-devel/message/15981