]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stream: Handle TASK_WOKEN_RES as a stream event
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 3 Mar 2026 11:50:36 +0000 (12:50 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 3 Mar 2026 14:16:10 +0000 (15:16 +0100)
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
include/haproxy/stream.h

index b4677cb2f374235bacd2dc044277a884f971000e..d5f07b9c87c033a1844105f444459ab9ca6aa46d 100644 (file)
@@ -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
index 46464f8601147db9bef406b7dcbb0f22e36643e7..09732bcf29286587a98124ae61df581e9990dd7f 100644 (file)
@@ -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)   |