Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 178274

Summary: start-stop-daemon checks for pidfile too quickly in some cases
Product: Gentoo Linux Reporter: Robin Johnson <robbat2>
Component: [OLD] Core systemAssignee: Roy Marples (RETIRED) <uberlord>
Status: RESOLVED FIXED    
Severity: major CC: base-system
Priority: High    
Version: 2007.0   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: If pidfile does not exist or is empty, continue

Description Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2007-05-13 01:56:46 UTC
While creating init scripts for mogilefsd and gearmand, I ran into a bit of weirdness.

On a slow machine, the problem does not occur, but on a sufficently fast Nway box, it does.

1. start-stop-daemon --start --pidfile="${PIDFILE}" --exec ${BINARY} -- ${OPTS}
2. s-s-d starts the binary.
3a. binary forks.
3b. the parent returns 0.
3c. the child writes the pidfile.
4. s-s-d checks the pidfile.

If #4 takes place before #3c, then the pidfile will not exist, and s-s-d will report failure, despite the daemon actually being up and running.

'-R number' only works for --stop, maybe make it work for --start as well, with a default like 2 seconds if the parent has already returned 0 and the pidfile doesn't exist?
Comment 1 Roy Marples (RETIRED) gentoo-dev 2007-05-13 11:00:37 UTC
Created attachment 119105 [details, diff]
If pidfile does not exist or is empty, continue

This patch allows for an empty or non existant pidfile for the duration of the alive test. If at the end of the test the pidfile is still empty or non existant we think the daemon has died.

Does this fix things for you?
Comment 2 Roy Marples (RETIRED) gentoo-dev 2007-05-14 15:14:29 UTC
Fixed in alpha3