The branch, master has been updated
       via  ea9e39369379939abf6a4076fa2014c10c1a9ad0 (commit)
       via  211ea7907e8e96041aa6f7d086551d64d065a8a3 (commit)
      from  5c8e56fc7a518e115bceac257867739283cf6a1e (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ea9e39369379939abf6a4076fa2014c10c1a9ad0
Author: Ronnie Sahlberg <ronniesahlb...@gmail.com>
Date:   Tue Dec 15 10:45:18 2009 +1100

    When setting up the logging, set the event to trigger a read of a log 
message from a child process as a child of the "log" structure and not the ctdb 
structure,
    or else we can crash if we receive log messages from a child but the log 
structure has been freed()

commit 211ea7907e8e96041aa6f7d086551d64d065a8a3
Author: Ronnie Sahlberg <ronniesahlb...@gmail.com>
Date:   Tue Dec 15 10:23:58 2009 +1100

    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 <ru...@rustcorp.com.au>

-----------------------------------------------------------------------

Summary of changes:
 server/ctdb_logging.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index 7dadbfd..770deb6 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -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;
@@ -506,7 +509,7 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
                return -1;
        }
 
-       event_add_fd(ctdb->ev, ctdb, p[0], EVENT_FD_READ, 
+       event_add_fd(ctdb->ev, ctdb->log, p[0], EVENT_FD_READ, 
                     ctdb_log_handler, ctdb->log);
        set_close_on_exec(p[0]);
        ctdb->log->pfd = p[0];


-- 
CTDB repository

Reply via email to