Revert "BUG/MINOR: task: Don't defer tasks release when HAProxy is stopping"

This reverts commit d9404b464f.

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.
This commit is contained in:
Christopher Faulet 2022-05-25 16:30:41 +02:00
parent 8c6176b8db
commit a45403f965

View 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;