]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: tasks: Don't account a destroyed task as a runned task.
authorOlivier Houchard <cognet@ci0.org>
Wed, 17 Apr 2019 20:53:41 +0000 (22:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 18 Apr 2019 08:11:13 +0000 (10:11 +0200)
In process_runnable_tasks(), if the task we're about to run has been
destroyed, and should be free, don't account for it in the number of task
we ran. We're only allowed a maximum number of tasks to run per call to
process_runnable_tasks(), and freeing one shouldn't take the slot of a
valid task.

src/task.c

index f38807c7a1e8549f6fd1ee1978f62936d35431be..b4f65e892a466a655e5c57a6dd6fff39278f1949 100644 (file)
@@ -388,7 +388,12 @@ void process_runnable_tasks()
                        t = process(TASK_IS_TASKLET(t) ? NULL : t, ctx, state);
                else {
                        __task_free(t);
-                       t = NULL;
+                       curr_task = NULL;
+                       /* We don't want max_processed to be decremented if
+                        * we're just freeing a destroyed task, we should only
+                        * do so if we really ran a task.
+                        */
+                       continue;
                }
                curr_task = NULL;
                /* If there is a pending state  we have to wake up the task