Merge lp:~jameinel/launchpad/lp-service into lp:launchpad
| Status: | Merged |
|---|---|
| Merge reported by: | John A Meinel |
| Merged at revision: | not available |
| Proposed branch: | lp:~jameinel/launchpad/lp-service |
| Merge into: | lp:launchpad |
| Diff against target: | 0 lines |
| To merge this branch: | bzr merge lp:~jameinel/launchpad/lp-service |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Hudson-Doyle | 2010-11-29 | Pending | |
| Launchpad code reviewers | 2010-11-29 | Pending | |
|
Review via email:
|
|||
This proposal supersedes a proposal from 2010-11-08.
Description of the Change
It looks like I accidentally targetted this to lp:launchpad/db-devel in the past, when it was meant to be targetted to lp:launchpad/devel. So I'm resubmitting. It has already been landed in db-devel, so there shouldn't be a reason to not land it into devel.
This adds a --pid-file option to "bzr launchpad-
This was brought out of the discussion of trying to get the service rolled out into qastaging.
see https:/
It would seem that 'start-stop-daemon' could be told to do the forking and pid-file management (--background and --make-pidfile), but it seems to state that "This is a last resort, and is only meant for programs that either make no sense forking on their own, or where it's not feasible to add the code for them to do this themselves."
The change seems reasonably localized, and hopefully reasonably tested. In general with IPC, I'm not always sure how to avoid both race conditions, hangs, and spurious failures. I chose 2.0s as a way to wait for the process to cleanup properly, but not block forever and hang the test suite.
| John A Meinel (jameinel) wrote : | # |
| Michael Hudson-Doyle (mwhudson) wrote : | # |
As I said on IRC, I think you should wait until the daemon process is accepting requests before proceeding in _start_subprocess.
The 'out' variable in _daemonize is strangely located and named -- can you call it something clearer and assign to it closer to its use? I don't think we need to chdir to /, so please delete that comment. I don't think we really need to setsid either, but it does no harm I guess.
It's a bit of a shame you had to write (or copy/paste) so much code for the process handling, but oh well. There are good reasons this daemon isn't using twistd.
| John A Meinel (jameinel) wrote : | # |
setsid() is recommended from the daemonize code I've read:
http://
os.chdir('/') is sort of recommended, but doesn't seem to be required.
I moved the '/dev/null' definition closer.
I think that addresses everything. If you could give it a once-over and then send it via ec2land, I would appreciate it.

Note that I still need some reviewer hand-holding to submit this to ec2, etc.