]> git.kaiwu.me - haproxy.git/commitdiff
fix: too much connection with -m option
authorFrederic Lecaille <flecaille@haproxy.com>
Mon, 22 Jun 2026 08:22:17 +0000 (10:22 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Mon, 22 Jun 2026 08:22:17 +0000 (10:22 +0200)
this is due to recent modifs, where the stream expiration info has been
moved to the hldstream struct (we do no more rely on the underlying
task expiration). But this expiration was not initialized and
taken as expiration value for the user task, leading this user
task to be wake up as soon as the first stream is intantiated. This
is not correct. The user task must wait for the connection establishment.

src/haload.c

index 0fb3e4cc0a174caeb218a75941a262156ac24e28..f4fc1565bbf2001f3a84df17e9545aa0252184ac 100644 (file)
@@ -1327,9 +1327,10 @@ static struct hldstream *hld_new_strm(struct hld_usr *usr,
 
        t->context = hs;
        t->process = hld_strm_task;
-       t->expire = TICK_ETERNITY;//tick_add(now_ms, MS_TO_TICKS(arg_wait));
+       t->expire = TICK_ETERNITY;
 
        hs->conn = conn;
+       hs->expire = tick_add(now_ms, MS_TO_TICKS(arg_wait));
        hs->hash = hash;
        hs->usr = usr;
        hs->url = url;
@@ -1470,6 +1471,7 @@ static struct task *hld_usr_task(struct task *t, void *context, unsigned int sta
        if (!LIST_ISEMPTY(&usr->strms)) {
                struct hldstream *first_hs =
                        LIST_ELEM(usr->strms.n, struct hldstream *, list);
+               BUG_ON(tick_is_expired(first_hs->expire, now_ms));
                usr->task->expire = first_hs->expire;
        }