]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: task/h2: add an idempotent task removal fucntion
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2019 17:02:54 +0000 (18:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2019 17:02:54 +0000 (18:02 +0100)
commite73256fd2a49a4a0623add6dfb07c7edc102eeb6
tree6a7ef561fc4690d695e8ade67c8a9e01e0c97963
parent3ea351368959da77aa873439d928704a07e0fe4e
BUG/MEDIUM: task/h2: add an idempotent task removal fucntion

Previous commit 3ea351368 ("BUG/MEDIUM: h2: Remove the tasklet from the
task list if unsubscribing.") uncovered an issue which needs to be
addressed in the scheduler's API. The function task_remove_from_task_list()
was initially designed to remove a task from the running tasklet list from
within the scheduler, and had to be used in h2 to abort pending I/O events.
However this function was not designed to be idempotent, occasionally
causing a double removal from the tasklet list, with the second doing
nothing but affecting the apparent tasks count and making haproxy use
100% CPU on some tests consisting in stopping the client during some
transfers. The h2_unsubscribe() function can sometimes be called upon
stream exit after an error where the tasklet was possibly already
removed, so it.

This patch does 2 things :
  - it renames task_remove_from_task_list() to
    __task_remove_from_tasklet_list() to discourage users from calling
    it. Also note the fix in the naming since it's a tasklet list and
    not a task list. This function is still uesd from the scheduler.
  - it adds a new, idempotent, task_remove_from_tasklet_list() function
    which does nothing if the task is already not in the tasklet list.

This patch will need to be backported where the commit above is backported.
include/proto/task.h
src/mux_h2.c
src/task.c