From: Arran Cudbard-Bell Date: Tue, 6 Apr 2021 11:27:15 +0000 (+0100) Subject: Deal with channels being closed on server exit X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcc8ce20b82d76cbf12268bbbcb5453ccbaa2fad;p=thirdparty%2Ffreeradius-server.git Deal with channels being closed on server exit --- diff --git a/src/lib/io/worker.c b/src/lib/io/worker.c index a0459c33a4..607b0a7a11 100644 --- a/src/lib/io/worker.c +++ b/src/lib/io/worker.c @@ -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); }