s3:winbind killed winbind child logs back trace
[obnox/samba-ctdb.git] / source3 / winbindd / winbindd.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);