The Samba-Bugzilla – Attachment 15058 Details for
Bug 13895
run_proc can lose output due to a race between fd and signal events
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.9 and 4.10
BZ13895.patch (text/plain), 1.72 KB, created by
Martin Schwenke
on 2019-04-13 02:00:02 UTC
(
hide
)
Description:
Patch for 4.9 and 4.10
Filename:
MIME Type:
Creator:
Martin Schwenke
Created:
2019-04-13 02:00:02 UTC
Size:
1.72 KB
patch
obsolete
>From 16bc83afa8de707e4119b178758437415857518e Mon Sep 17 00:00:00 2001 >From: Amitay Isaacs <amitay@samba.org> >Date: Tue, 9 Apr 2019 14:44:04 +1000 >Subject: [PATCH] ctdb-common: Avoid race between fd and signal events > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13895 > >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. > >Signed-off-by: Amitay Isaacs <amitay@gmail.com> >Reviewed-by: Martin Schwenke <martin@meltin.net> > >Autobuild-User(master): Amitay Isaacs <amitay@samba.org> >Autobuild-Date(master): Fri Apr 12 08:19:29 UTC 2019 on sn-devel-144 > >(cherry picked from commit 289201277cd983b27cdfd5376c607eab112b4082) >--- > ctdb/common/run_proc.c | 7 +++++++ > 1 file changed, 7 insertions(+) > >diff --git a/ctdb/common/run_proc.c b/ctdb/common/run_proc.c >index 97895b383b9..037b6d9651d 100644 >--- a/ctdb/common/run_proc.c >+++ b/ctdb/common/run_proc.c >@@ -295,6 +295,13 @@ again: > proc->result.sig = WTERMSIG(status); > } > >+ /* Confirm that all data has been read from the pipe */ >+ if (proc->fd != -1) { >+ proc_read_handler(ev, proc->fde, 0, proc); >+ TALLOC_FREE(proc->fde); >+ proc->fd = -1; >+ } >+ > /* Active run_proc request */ > if (proc->req != NULL) { > run_proc_done(proc->req); >-- >2.20.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
amitay
:
review+
Actions:
View
Attachments on
bug 13895
: 15058