[PATCH] Handle SIGCHLD better in process_standard, remove process_{onefork,prefork}

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Mar 2 08:21:05 MST 2015


On Mon, Mar 02, 2015 at 05:14:32PM +1300, Andrew Bartlett wrote:
> This patch set shows a good (better?) way to handle cleaning up dead
> sockets from child process, because rather than expecting SIGCHLD and
> handling that (doing a waitpid on all pids, including a PID that someone
> else is hoping to clean up), we use the read event on the socket to know
> exactly which child exited.  
> 
> You might want to do something similar in source3/ or hook the source3
> process termination code up to this code. 

In source3/smbd/server.c we have a routine smbd_sig_chld_handler() that
is able to figure out which child died. We maintain a list of normal smbd
worker children, and in remove_child_pid() we have a DEBUG message that
fires when an "unknown" child according to our list exits. This works
pretty well even under high load. We respond to the MSG_SMB_NUM_CHILDREN
control and this seems very reliable according to our tests.

I'm happy to improve this, but right now I don't see a problem with
the smbd code. Can you clarify what the new approach fixes beyond what
we have?

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list