From 13c34451632202cde45a44d299c50a37cf0772f3 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 3 Mar 2026 12:50:36 +0100 Subject: [PATCH] BUG/MEDIUM: stream: Handle TASK_WOKEN_RES as a stream event The conversion of TASK_WOKEN_RES to a stream event was missing. Among other things, this wakeup reason is used when a stream is dequeued. So it was possible to skip the connection establishment if the stream was also woken up for a timer reason. When this happened, the stream was blocked till the queue timeout expiration. Converting TASK_WOKEN_RES to STRM_EVT_RES fixes the issue. This patch should fix the issue #3290. It must be backported as far as 3.2. --- include/haproxy/stream-t.h | 1 + include/haproxy/stream.h | 1 + 2 files changed, 2 insertions(+) diff --git a/include/haproxy/stream-t.h b/include/haproxy/stream-t.h index b4677cb2f..d5f07b9c8 100644 --- a/include/haproxy/stream-t.h +++ b/include/haproxy/stream-t.h @@ -180,6 +180,7 @@ enum { STRM_EVT_SHUT_SRV_DOWN = 0x00000004, /* Must be shut because the selected server became available */ STRM_EVT_SHUT_SRV_UP = 0x00000008, /* Must be shut because a preferred server became available */ STRM_EVT_KILLED = 0x00000010, /* Must be shut for external reason */ + STRM_EVT_RES = 0x00000020, /* A requested resource is available (a buffer, a conn_slot...) */ }; /* This function is used to report flags in debugging tools. Please reflect diff --git a/include/haproxy/stream.h b/include/haproxy/stream.h index 46464f860..09732bcf2 100644 --- a/include/haproxy/stream.h +++ b/include/haproxy/stream.h @@ -412,6 +412,7 @@ static inline void stream_shutdown(struct stream *s, int why) static inline unsigned int stream_map_task_state(unsigned int state) { return ((state & TASK_WOKEN_TIMER) ? STRM_EVT_TIMER : 0) | + ((state & TASK_WOKEN_RES) ? STRM_EVT_RES : 0) | ((state & TASK_WOKEN_MSG) ? STRM_EVT_MSG : 0) | ((state & TASK_F_UEVT1) ? STRM_EVT_SHUT_SRV_DOWN : 0) | ((state & TASK_F_UEVT3) ? STRM_EVT_SHUT_SRV_UP : 0) |