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 826b193..b3e0544 100644
--- a/include/haproxy/task.h
+++ b/include/haproxy/task.h
@@ -609,8 +609,8 @@
}
/* 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 @@
/* 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;