From: Willy Tarreau Date: Tue, 22 Sep 2026 21:15:20 +0000 (+0000) Subject: REGTESTS: sample_fetches: do not race with the server close in proxy_state X-Git-Tag: v3.5-dev8~12 X-Git-Url: https://git.kaiwu.me/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=212afc516352f15ff30836f5f2587b2a8da356f3;p=haproxy.git REGTESTS: sample_fetches: do not race with the server close in proxy_state A full run of the suite caught srv_conn() reporting zero where the test expects one. The server closed its connection as soon as it had answered, and when that close reached haproxy before the response rules were evaluated, the server connection was already released and the counter had gone back to zero. The server now holds its connection until the client has read the response, which is necessarily after the rules have run. --- diff --git a/reg-tests/sample_fetches/proxy_state.vtc b/reg-tests/sample_fetches/proxy_state.vtc index 023176be2..61e11b6c0 100644 --- a/reg-tests/sample_fetches/proxy_state.vtc +++ b/reg-tests/sample_fetches/proxy_state.vtc @@ -9,12 +9,20 @@ varnishtest "Test the proxy and server state sample fetches" # A single thread is used because act_conn and fe_conn are over-counted # when several threads accept in parallel on a loaded machine, which # would make the connection counters below unpredictable. +# +# The server holds its connection until the client has read the response +# because srv_conn() counts the established connections: if the server +# closed as soon as it answered, its connection could be released before +# the response rules run and the counter would be read as zero. feature ignore_unknown_macro +barrier b1 cond 2 + server s1 { rxreq txresp + barrier b1 sync } -start haproxy h1 -conf { @@ -105,6 +113,7 @@ haproxy h1 -conf { client c1 -connect ${h1_fe_sock} { txreq rxresp + barrier b1 sync expect resp.status == 200 expect resp.http.x-feid == "11"