Merge lp:~jameinel/launchpad/lp-service into lp:launchpad/db-devel
| Status: | Superseded |
|---|---|
| Proposed branch: | lp:~jameinel/launchpad/lp-service |
| Merge into: | lp:launchpad/db-devel |
| Diff against target: |
273 lines (+194/-11) 2 files modified
bzrplugins/lpserve/__init__.py (+53/-1) bzrplugins/lpserve/test_lpserve.py (+141/-10) |
| To merge this branch: | bzr merge lp:~jameinel/launchpad/lp-service |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Hudson-Doyle | 2010-11-08 | Approve on 2010-11-08 | |
| Launchpad code reviewers | 2010-11-08 | Pending | |
|
Review via email:
|
|||
This proposal has been superseded by a proposal from 2010-11-29.
Commit Message
Add '--pid-file' to launchpad-
Description of the Change
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.