Bug 9035 - bitbake-prserv not exiting on SIGTERM when run in daemon mode
Summary: bitbake-prserv not exiting on SIGTERM when run in daemon mode
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: 2.0.2
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.1 M3
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-02-02 13:42 UTC by Diego Santa cruz
Modified: 2016-02-11 20:59 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Fix for SIGTERM handling in daemon mode (1.26 KB, text/plain)
2016-02-02 13:42 UTC, Diego Santa cruz
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.