; a=shortlog; h=refs/heads/master4-double-fork

simo simo at
Wed Oct 27 10:35:30 MDT 2010

On Wed, 2010-10-27 at 09:51 +0200, Stefan (metze) Metzmacher wrote:
> Hi,
> during the Storage Developer Conference 2010 I researched how we can
> implement helper processes in library code.
> The goal was to avoid setting global signal handlers and to avoid
> threads.
> The solution I found (with help from Tridge) was to use a 2 staged
> fork() in order to avoid generating SIGCHLD from the child.
> At the same time the child should never endup as zombie.
> My first implementation is available here:
> It passes our autobuild tests, but I want to do some more testing before
> pushing
> it to master.
> It would be nice to get some comments.
> The double_fork() function could be the basis for some really useful
> higher level
> async functions. We could use it to implement fully async wrappers for
> libraries
> like gssapi, cups and others, which have no native way to plug into our
> tevent library.

Very clever.

The only concern I have is that this will double the penalty for fork in
processes that have already allocated a bunch of memory and so have a
lot of pages to track per process.

But it looks we are using this to run pretty slow scripts anyway if I am
correct, so it looks like a good enough compromise.


Simo Sorce
Samba Team GPL Compliance Officer <simo at>
Principal Software Engineer at Red Hat, Inc. <simo at>

More information about the samba-technical mailing list