[PATCH] ctdb-common: Avoid race between fd and signal events (bug 13895)

Amitay Isaacs amitay at gmail.com
Fri Apr 12 07:12:25 UTC 2019


In run_proc, there was an implicit assumption that when a process exits,
fd event (pipe between parent and child) would be processed first and
signal event (SIGCHLD for the child) would be processed later.

However, that is not the case.  SIGCHLD can be received asynchronously
any time even when the pipe data has not fully been read.  This causes
run_proc to miss some of the output from child process in tests.

When SIGCHLD is being processed, if the pipe between parent and child is
still open, then do an explict read from the pipe to ensure we read any
data still in the pipe before closing the pipe.

Please review and push.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ctdb-common-Avoid-race-between-fd-and-signal-events.patch
Type: text/x-patch
Size: 1563 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20190412/8ee19340/0001-ctdb-common-Avoid-race-between-fd-and-signal-events.bin>

More information about the samba-technical mailing list