BUG/MEDIUM: quic_conn: let the scheduler kill the task when needed
authorWilly Tarreau <w@1wt.eu>
Tue, 17 Oct 2023 15:00:10 +0000 (17:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 17 Oct 2023 15:14:06 +0000 (17:14 +0200)
commit4070e4042a1fbe64fa820992c63af7284735e854
tree0082215c12d51fcba1692e6f2327726cf0a753e3
parent5714aff4a6bf1a59701c875979d3dade02d34e1d
BUG/MEDIUM: quic_conn: let the scheduler kill the task when needed

The two timer handlers qc_process_timer() and qc_idle_timer_task() would
inadvertently return NULL when they don't want to be requeued, instead
of just returning the task itself. The effect of returning NULL for the
scheduler is that it considers the task as freed, so it must not touch
it anymore. As such, the TASK_F_RUNNING flag is never removed from these
tasks, and when quic_conn_release() later tries to release these tasks
using task_destroy(), the latter sees the RUNNING flag and just sets
->process to NULL, hoping that the scheduler will kill them on return,
but there's no longer being executed so this never happens and they are
leaked.

Interestingly, this doesn't seem to happen as much when multi-queue is
set to off, but it's likely because the tasks are being replaced and the
first ones have already been woken up and leaked, while the latter might
only trigger on a timeout or timer renewal.

This should address github issue #2310. Thanks to @hpn0t0ad for the
numerous traces that helped understand this sequence.

This must be backported to 2.7 at least, and adapted for 2.6
(qc_idle_timer_task must return t there).
src/quic_conn.c