BUG/MINOR: quic: Unexpected connection closures upon idle timer task execution
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 4 Apr 2023 08:46:54 +0000 (10:46 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 4 Apr 2023 16:24:28 +0000 (18:24 +0200)
commit12eca3a727b3278cf456b0f62da9d91c4b9c2a27
tree750a1e9815795d7fae2d86fcee73a3425f8b0df8
parent495968ed51b64cc818e32e09eeb412183b701336
BUG/MINOR: quic: Unexpected connection closures upon idle timer task execution

This bug arrived with this commit:

      MEDIUM: quic: Ack delay implementation

It is possible that the idle timer task was already in the run queue when its
->expire field was updated calling qc_idle_timer_do_rearm(). To prevent this
task from running in this condition, one must check its ->expire field value
with this condition to run the task if its timer has really expired:

!tick_is_expired(t->expire, now_ms)

Furthermore, as this task may be directly woken up with a call to task_wakeup()
all, for instance by qc_kill_conn() to kill the connection, one must check this
task has really been woken up when it was in the wait queue and not by a direct
call to task_wakeup() thanks to this test:

(state & TASK_WOKEN_ANY) == TASK_WOKEN_TIMER

Again, when this condition is not fulfilled, the task must be run.

Must be backported where the commit mentionned above was backported.
src/quic_conn.c