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

Andrew Bartlett abartlet at samba.org
Sun Mar 1 21:14:32 MST 2015

Attached is a patch set to properly handle SIGCHLD in process_standard
in the source4/ code, and in doing so ensure we catch errors from
samba_kcc and samba_dnsupdate.


Can you look over this and if you are happy, review/push?  I would like
to have tests for a change like this, so if you have any good ideas
about how to do that, please let me know.  I've tested it manually by
killing off children with kill -9, and natrually the success case will
be covered well in autobuild. 

Also, what do you think about removing process_prefork and
process_onefork?  I added them both - prefork I did as an exercise to
teach ddiss Samba4 development, and I can't remember why I did onefork -
I think it may have been for ideas around s3compat.  As far as I can
tell they are unused, but could in theory be invoked from the command

Otherwise, they would need to be rewritten to use some common lib code
with process_standard. 


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. 


Andrew Bartlett
Andrew Bartlett
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s4-process_standard-Remove-signal-SIGCHLD-SIG_IGN.patch
Type: text/x-patch
Size: 6540 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150302/ae5562a8/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-lib-util-Make-ECHILD-in-samba_runcmd_io_handler-an-e.patch
Type: text/x-patch
Size: 1231 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150302/ae5562a8/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-s4-process_model-Remove-prefork-and-onefork.patch
Type: text/x-patch
Size: 12334 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150302/ae5562a8/attachment-0005.bin>

More information about the samba-technical mailing list