From 93a19121634bab7f51cee5c5c4e576668b171275 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Wed, 10 Nov 2010 18:37:02 +0100 Subject: [PATCH] s3:winbind killed winbind child logs back trace 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 | 17 +++++++++++++++++ source3/winbindd/winbindd_dual.c | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index ee40187fd2..a032436a01 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -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); diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index efe15138bb..872ab1ce42 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -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. -- 2.34.1