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

Bug 285801

Summary: sys-apps/openrc-0.4.3-r3: WAIT_PIDFILE needs to be configurable
Product: Gentoo Linux Reporter: Robin Johnson <robbat2>
Component: [OLD] Core systemAssignee: Roy Marples <roy>
Status: RESOLVED INVALID    
Severity: normal CC: base-system
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-09-21 01:58:18 UTC
While trying to trace why several apps (all written in Perl) on my system always report 'crashed' status, I ultimately traced it to the WAIT_PIDFILE interval being too short.

The apps follow the following pattern:
1. startup
2. basic checks
3. fork() to daemon
3.1. original exec returns to s-s-d
4. daemon does more complex checks
5. daemon writes pidfile.

If #4 takes longer than the WAIT_PIDFILE interval, then it will do one of two things:
1. If --pidfile was NOT specified, s-s-d reports successful start, but later reports status as 'crashed'.
2. If --pidfile was specified, s-s-d fails hard, with:
start-stop-daemon: did not create a valid pid in `$FOO'
Comment 1 Roy Marples 2009-09-21 06:14:50 UTC
Obviously the daemon should carry out complex checks AND writes the pidfile BEFORE forking. Any other situation is prone to racing.

But this bug is invalid anyway - OpenRC-0.5 ditched WAIT_PIDFILE and now supports 3 ways of setting it - command line -w N, env var SSD_STARTWAIT=N or rc_start_wait set in a configuration file. The default is 0.