From: Arran Cudbard-Bell Date: Tue, 5 Mar 2024 16:48:31 +0000 (-0600) Subject: Attempt to fix assert on timeout of subrequests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55e03226ee36ba20dc0a2d7f5306840cf32ff163;p=thirdparty%2Ffreeradius-server.git Attempt to fix assert on timeout of subrequests --- diff --git a/src/lib/io/worker.c b/src/lib/io/worker.c index 230d465df10..da838f74d99 100644 --- a/src/lib/io/worker.c +++ b/src/lib/io/worker.c @@ -46,6 +46,7 @@ * * @copyright 2016 Alan DeKok (aland@freeradius.org) */ + RCSID("$Id$") #define LOG_PREFIX worker->name @@ -59,6 +60,7 @@ RCSID("$Id$") #include #include #include +#include #include #include @@ -1197,17 +1199,22 @@ static void _worker_request_done_detached(request_t *request, UNUSED rlm_rcode_t */ static void _worker_request_detach(request_t *request, UNUSED void *uctx) { -// fr_worker_t *worker = talloc_get_type_abort(uctx, fr_worker_t); + fr_worker_t *worker = talloc_get_type_abort(uctx, fr_worker_t); - RDEBUG3("Request is detached"); - fr_assert(request_is_detached(request)); + if (request_is_detachable(request)) { + /* + * End the time tracking... We don't track detached requests, + * because they don't contribute for the time consumed by an + * external request. + */ + worker_request_time_tracking_end(worker, request, fr_time()); - /* - * End the time tracking... We don't track detached requests, - * because they don't contribute for the time consumed by an - * external request. - */ -// worker_request_time_tracking_end(worker, request, fr_time()); + if (request_detach(request) < 0) RPEDEBUG("Failed detaching request"); + + RDEBUG3("Request is detached"); + } else { + fr_assert_msg(0, "Request is not detachable"); + } return; } diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index 7674008a966..4a74fbc8d21 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -1108,9 +1108,8 @@ void unlang_interpret_request_detach(request_t *request) if (!request_is_detachable(request)) return; intp = stack->intp; - intp->funcs.detach(request, intp->uctx); - if (request_detach(request) < 0) RPEDEBUG("Failed detaching request"); + intp->funcs.detach(request, intp->uctx); } /** Send a signal (usually stop) to a request diff --git a/src/lib/unlang/interpret_synchronous.c b/src/lib/unlang/interpret_synchronous.c index 7df176e2597..1e05dc8445c 100644 --- a/src/lib/unlang/interpret_synchronous.c +++ b/src/lib/unlang/interpret_synchronous.c @@ -101,6 +101,8 @@ static void _request_done_detached(request_t *request, UNUSED rlm_rcode_t rcode, static void _request_detach(request_t *request, UNUSED void *uctx) { RDEBUG3("Synchronous request detached"); + + if (request_detach(request) < 0) RPEDEBUG("Failed detaching request"); } /** Request has been stopped