]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Deal with channels being closed on server exit
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 6 Apr 2021 11:27:15 +0000 (12:27 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 6 Apr 2021 11:28:16 +0000 (12:28 +0100)
src/lib/io/worker.c

index a0459c33a4c4ea0deab214af70bea1ba51837e2b..607b0a7a11f788f93b4831e4d9ac64977f87e156 100644 (file)
@@ -977,6 +977,18 @@ static void _worker_request_done_external(request_t *request, UNUSED rlm_rcode_t
                      "Request %s stack depth %u > 0", request->name, unlang_interpret_stack_depth(request));
        RDEBUG("Done request");
 
+       /*
+        *      These conditions are true when the server is
+        *      exiting and we're stopping all the requests.
+        *
+        *      This should never happen otherwise.
+        */
+       if (unlikely((request->master_state == REQUEST_STOP_PROCESSING) &&
+                    !fr_channel_active(request->async->channel))) {
+               talloc_free(request);
+               return;
+       }
+
        worker_send_reply(worker, request, request->master_state == REQUEST_STOP_PROCESSING ? 1 : 0, fr_time());
        talloc_free(request);
 }