]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
Revert "BUG/MINOR: task: Don't defer tasks release when HAProxy is stopping"
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 25 May 2022 14:30:41 +0000 (16:30 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 25 May 2022 14:41:52 +0000 (16:41 +0200)
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.

include/haproxy/task.h

index 826b193d6add570eccb8ad889bc4ff0357cf3a5d..b3e054408e886d5846400fca82fe1d2828a805fe 100644 (file)
@@ -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 <t> is NULL.
+ * the current task or not queued otherwise it's marked to be freed by the
+ * scheduler. It does nothing if <t> 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;