From: Willy Tarreau Date: Fri, 7 Feb 2025 17:01:32 +0000 (+0100) Subject: BUG/MINOR: debug: make sure the "debug dev sched" tasks don't block stopping X-Git-Tag: v3.2-dev5~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d63dc50ab2bfb0aceb486ad5f99b2b380430f16;p=thirdparty%2Fhaproxy.git BUG/MINOR: debug: make sure the "debug dev sched" tasks don't block stopping When "debug dev sched" is used to pop up background tasks, these tasks are never stopped, so we must be careful to stop them when the stopping flag is set, otherwise they can prevent the process from stopping when sufficiently numerous (tests went as far as 100 million tasks, leading the run queue never being completely purged in one poll round). No backport is needed since this is only used when debugging and tuning the scheduler. --- diff --git a/src/debug.c b/src/debug.c index 6f8f5a964..61254ba4e 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1520,6 +1520,9 @@ static struct task *debug_task_handler(struct task *t, void *ctx, unsigned int s unsigned long inter = tctx[1]; unsigned long rnd; + if (stopping) + return NULL; + t->expire = tick_add(now_ms, inter); /* half of the calls will wake up another entry */ @@ -1543,6 +1546,9 @@ static struct task *debug_tasklet_handler(struct task *t, void *ctx, unsigned in unsigned long rnd; int i; + if (stopping) + return NULL; + /* wake up two random entries */ for (i = 0; i < 2; i++) { rnd = statistical_prng() % tctx[0];