[paludis-user] Workaround for problem with distcc + outputwrapper

Benjamin R. Haskell paludis at benizi.com
Thu Feb 25 07:44:10 UTC 2010


On Wed, 24 Feb 2010, Ciaran McCreesh wrote:

> On Mon, 25 Jan 2010 03:01:22 -0500 (EST) "Benjamin R. Haskell" <paludis at benizi.com> wrote:
> > At some point, Ciaran McCreesh wrote:
> >
> > > I suspect the real problem is that the daemon doesn't fork itself 
> > > twice, to make itself owned by init rather than the spawning 
> > > process.
> >
> > ...the daemon spawned by distcc -j appears to not double-fork, but 
> > it does setsid().  And, the attached program triggers the same 
> > behavior w.r.t. outputwrapper, unless called with the 
> > with-closed-fds wrapper from my initial email.  
> > (double-forked-simple.c just double forks, closes fd's 0-2, 
> > setsid()s, and sleeps for 20 seconds.)  But maybe I'm missing 
> > something the 'distcc' code misses, too.
> 
> Sessions are something else. They're not related to reparenting.

Interesting.  I've not done a ton of work with low-level forking/etc, so 
I didn't fully comprehend that.

Nonetheless, the program I attached before still demonstrates the 
problem, even with double-forking.  And attached is an even more minimal 
program that demonstrates the problem.

Compile: gcc -Wall -o minimal-double-fork{,.c}

Testing: (one line)
PALUDIS_EBUILD_DIR=/usr/libexec/paludis /usr/libexec/paludis/utils/outputwrapper --stdout-prefix 'stdout> ' --stderr-prefix 'stderr> ' -- ./minimal-double-fork

If the 'i<3' in the program is changed to 'i<30', the pause disappears.

Sorry to beat a dead horse, but at this point I'm mostly curious for 
future reference.

-- 
Best,
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal-double-fork.c
Type: text/x-c
Size: 226 bytes
Desc: 
URL: <http://lists.exherbo.org/pipermail/paludis-user/attachments/20100225/10480eb1/attachment.c>


More information about the paludis-user mailing list