s3:winbind killed winbind child logs back trace
authorChristian Ambach <christian.ambach@de.ibm.com>
Wed, 10 Nov 2010 17:37:02 +0000 (18:37 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 22 Nov 2010 12:56:45 +0000 (13:56 +0100)
change the signal that the winbind parent sends to a children
that timed out answering a request from SIGTERM to SIGXCPU

By adding this differentation, it is possible to dump
a backtrace of the child only in this case, not when winbind
is shutting down
The backtrace is meant as a debug aid to determine what
a child was waiting for when it timed out

source3/winbindd/winbindd.c
source3/winbindd/winbindd_dual.c

index ee40187fd29ebab640d7dc2dcd98586d68923f7e..a032436a0172e375d2208626a9aab1a86967391d 100644 (file)
@@ -190,6 +190,12 @@ static void winbindd_sig_term_handler(struct tevent_context *ev,
 
        DEBUG(0,("Got sig[%d] terminate (is_parent=%d)\n",
                 signum, (int)*is_parent));
+
+       /* if the parent killed us due to a timeout log where we were */
+       if (signum == SIGXCPU) {
+               log_stack_trace_with_level(1);
+       }
+
        terminate(*is_parent);
 }
 
@@ -238,6 +244,16 @@ bool winbindd_setup_sig_term_handler(bool parent)
                return false;
        }
 
+       se = tevent_add_signal(winbind_event_context(),
+                              is_parent,
+                              SIGXCPU, 0,
+                              winbindd_sig_term_handler,
+                              is_parent);
+       if (!se) {
+               DEBUG(0,("failed to setup SIGXCPU handler"));
+               talloc_free(is_parent);
+               return false;
+       }
        return true;
 }
 
@@ -1292,6 +1308,7 @@ int main(int argc, char **argv, char **envp)
        BlockSignals(False, SIGUSR2);
        BlockSignals(False, SIGHUP);
        BlockSignals(False, SIGCHLD);
+       BlockSignals(False, SIGXCPU);
 
        if (!interactive)
                become_daemon(Fork, no_process_group);
index efe15138bb936369ed8ea1b26bcc9e9918202b09..872ab1ce4231b661c4048b806f14cf36a54545e7 100644 (file)
@@ -206,7 +206,7 @@ static void async_request_fail(struct winbindd_async_request *state)
        if ((state->child->pid != (pid_t)0) &&
                        (state->child->pid != (pid_t)-1) &&
                        (state->child->pid == state->child_pid)) {
-               kill(state->child_pid, SIGTERM);
+               kill(state->child_pid, SIGXCPU);
 
                /* 
                 * Close the socket to the child.