From: Alan T. DeKok Date: Mon, 30 Nov 2009 08:14:27 +0000 (+0100) Subject: Clean up "dead" child if there's no thread associated with the request X-Git-Tag: release_2_1_8~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51aaf3e7d59100b6ff3f90ce7faa7f558a46215f;p=thirdparty%2Ffreeradius-server.git Clean up "dead" child if there's no thread associated with the request --- diff --git a/src/main/event.c b/src/main/event.c index 186bdc5b1b4..1d0849ebf9b 100644 --- a/src/main/event.c +++ b/src/main/event.c @@ -469,8 +469,14 @@ static void wait_for_child_to_die(void *ctx) rad_assert(request->magic == REQUEST_MAGIC); - if ((request->child_state == REQUEST_QUEUED) | - (request->child_state == REQUEST_RUNNING)) { + /* + * If it's still queued (waiting for a thread to pick it + * up) OR, it's running AND there's still a child thread + * handling it, THEN delay some more. + */ + if ((request->child_state == REQUEST_QUEUED) || + ((request->child_state == REQUEST_RUNNING) && + (pthread_equal(request->child_pid, NO_SUCH_CHILD_PID) == 0))) { /* * Cap delay at five minutes.