From: Christopher Faulet Date: Wed, 25 May 2022 14:30:41 +0000 (+0200) Subject: Revert "BUG/MINOR: task: Don't defer tasks release when HAProxy is stopping" X-Git-Tag: v2.6-dev12~113 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a45403f9658ba8251659cd1c513df15ecb98d8aa;p=thirdparty%2Fhaproxy.git Revert "BUG/MINOR: task: Don't defer tasks release when HAProxy is stopping" This reverts commit d9404b464faae3340ac1745b594929e4b7edd650. In fact, there is a BUG_ON() in __task_free() function to be sure the task is no longer in the wait-queue or the run-queue. Because the patch tries to fix a "leak" on deinit, it is safer to revert it. there is no reason to introduce potential bug for this kind of issues. And there is no reason to impact the normal use-cases at runtime with additionnal conditions to only remove a task on deinit. --- diff --git a/include/haproxy/task.h b/include/haproxy/task.h index 826b193d6a..b3e054408e 100644 --- a/include/haproxy/task.h +++ b/include/haproxy/task.h @@ -609,8 +609,8 @@ static inline void __task_free(struct task *t) } /* Destroys a task : it's unlinked from the wait queues and is freed if it's - * the current task or not queued or if HAProxy is stopping. Otherwise it's - * marked to be freed by the scheduler. It does nothing if is NULL. + * the current task or not queued otherwise it's marked to be freed by the + * scheduler. It does nothing if is NULL. */ static inline void task_destroy(struct task *t) { @@ -627,7 +627,7 @@ static inline void task_destroy(struct task *t) /* There's no need to protect t->state with a lock, as the task * has to run on the current thread. */ - if (t == th_ctx->current || !(t->state & (TASK_QUEUED | TASK_RUNNING)) || (global.mode & MODE_STOPPING)) + if (t == th_ctx->current || !(t->state & (TASK_QUEUED | TASK_RUNNING))) __task_free(t); else t->process = NULL;