Bug 9035

Summary: bitbake-prserv not exiting on SIGTERM when run in daemon mode
Product: [Build System, Metadata & Runtime] BitBake Reporter: Diego Santa cruz <Diego.SantaCruz>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher
Version: 2.0.2   
Target Milestone: 2.1 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Fix for SIGTERM handling in daemon mode none

Description Diego Santa cruz 2016-02-02 13:42:08 UTC
Created attachment 2963 [details]
Fix for SIGTERM handling in daemon mode

I am running bitbake-prserv in daemon mode and noticed that it does not exit when a SIGTERM is sent to it.

Using "bitbake-prserv --stop" works fine, but sending a SIGTERM to the pid of the daemonized bitbake-prserv hungs it and then even a "bitbake-prserv --stop" is not able to stop it.

The problem seems to be that the handler thread is not signaled to quit, so it stays there doing its work, as it is not a daemon thread (i.e. the python thread is created in non-daemon mode).

The attached patch fixes this by setting the quit variable instead. The patch also does not raise the SystemExit exception any longer but instead leaves the quit flag to do its job and do a clean exit. This way the PID file is properly removed.