mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
From rusty:
Subject: eventscript: fix spinning at 100% cpu when child exits. ctdbd was spinning reading 0 from a pipe, as soon as the first eventscript finishes. This was caused by the intersection between a78b8ea7168e "Run only one event for each epoll_wait/select call" and 32cfdc3aec34 "eventscript: ctdb_fork_with_logging()". Unavoidable mid-air collision, since both worked fine and both were developed simultaneously. When the script exits, we have two pipes open to it: one for any stdout/stderr for logging (ctdb_log_handler), and one for the result (ctdb_event_script_handler). The latter frees everything, including the log fd and event structure. We used to get one callback to ctdb_log_handler, which got a harmless 0-length read, then one to ctdb_event_script_handler which cleaned up. Now we only do one callback per poll, we need the logging function to clean itself up so we can make process. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 211ea7907e8e96041aa6f7d086551d64d065a8a3)
This commit is contained in:
parent
649ba2631d
commit
db0d2a1b8f
@ -381,6 +381,9 @@ static void ctdb_log_handler(struct event_context *ev, struct fd_event *fde,
|
||||
sizeof(log->buf) - log->buf_used);
|
||||
if (n > 0) {
|
||||
log->buf_used += n;
|
||||
} else if (n == 0) {
|
||||
talloc_free(log);
|
||||
return;
|
||||
}
|
||||
|
||||
this_log_level = script_log_level;
|
||||
|
Loading…
Reference in New Issue
Block a user