Clean up "dead" child if there's no thread associated with the request
authorAlan T. DeKok <aland@freeradius.org>
Mon, 30 Nov 2009 08:14:27 +0000 (09:14 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 30 Nov 2009 08:14:27 +0000 (09:14 +0100)
src/main/event.c

index ce9ce46..4134303 100644 (file)
@@ -488,8 +488,14 @@ static void wait_for_child_to_die(void *ctx)
 
        rad_assert(request->magic == REQUEST_MAGIC);
 
+       /*
+        *      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)) {
+           ((request->child_state == REQUEST_RUNNING) &&
+            (pthread_equal(request->child_pid, NO_SUCH_CHILD_PID) == 0))) {
 
                /*
                 *      Cap delay at five minutes.