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.
This commit is contained in:
Willy Tarreau 2025-02-07 18:01:32 +01:00
parent 6765a32eb4
commit 8d63dc50ab

View File

@ -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];