]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: applet: Reenable reads in applet context if requesting a connection
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 10 Jul 2026 09:53:33 +0000 (11:53 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 10 Jul 2026 10:03:18 +0000 (12:03 +0200)
commit16d259c5db02997e2da47d77bb4f71fa09197c89
treea623484cc86ebc6c9669ad0ca67ead23fd284956
parent55a1bb9e09a2cef900e4a87398719754babddf03
BUG/MEDIUM: applet: Reenable reads in applet context if requesting a connection

When a applet is waiting for a connection, like Socket applet in lua, reads
are blocked. When the connection is finally available , a read activity is
reported and reads are reenabled (flag SE_FL_APPLET_NEED_CONN is removed).

However, most of time (always ?), this operation is performed in the context
of the connection and the applet is woken up. It means the task expiration
date is not updated where the read activity is reported. It is an issue for
small timeouts because the task may be queued in past, triggering a BUG_ON
in sc_notify(). In fact, a read activity must never be reported in another
context of the endpoint itself or the upper stream, specifically to properly
set the task expiration date.

To fix the issue, in sc_chk_rcv(), the applet is only woken up in that case
and the reads are re-enabled when the applet is executed. For applets using
the new API, it is performed in sc_appet_sync_recv(). For legacy applets, it
is directly performed in task_run_applet().

This patch is related to #3442. It must be backported as far as 2.8. On the
2.8, only task_run_applet must be fixed because sc_applet_sync_recv() does
not exist.
src/applet.c
src/stconn.c