The c3 client sends its tunneled data in a DATA frame carrying END_STREAM,
right after the CONNECT request. Since abortonclose is enabled by default
on HTTP proxies (commit 644b3dc7d in 3.3-dev10), this END_STREAM aborts
the connection attempt when it is processed while the connection to the
server is still in progress: the log shows "CC--" and the client gets an
RST_STREAM (REFUSED_STREAM) instead of the 200 response.
This depends on how fast the server connection is established. On Linux,
a connection to a loopback address is already established when connect()
returns, so it is confirmed as soon as the request is sent, before the
END_STREAM is taken into account, and the test passes. On macOS, it is
only reported later by kqueue, and the test failed about half of the
time, each time the payload of the DATA frame was received after the
connection attempt had started but before the connection was reported.
The c3 scenario is meant to check tunneled data received by the H2
multiplexer before the request is forwarded (see commit d75b84234). The
abort only happens when the data arrive later, while the connection is
being established, which is not the case this scenario is about. So
let's disable abortonclose on fe_h2, which does not change the tested
case. Sending the data without END_STREAM is not an option: haproxy may
then emit the stream WINDOW_UPDATE in two frames, which the client does
not expect.
The test only exists in 3.5-dev, so no backport is needed.
---
On macOS (Darwin 24.6, clang 17), the test failed 15 times out of 30 on
master ed3ba6581 before this change, and passed 50 times out of 50 after
it. On Linux x86_64 (Rocky 9, gcc 11.5), it passed 30 times out of 30
both before and after.
This assumes that aborting a tunnel attempt when the client ends its
stream before the server connection is established is the expected
effect of abortonclose. If it is not, the fix rather belongs to haproxy
itself, and this patch can be dropped.
I found it while running the full suite for another series ("BUG/MEDIUM:
pattern: don't rely on the trash size to read pattern files"). Please
keep me CCed, I'm not subscribed to the list.
Thanks,
Dongwon Jang
reg-tests/http-messaging/connect_tunnels.vtc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/reg-tests/http-messaging/connect_tunnels.vtc
b/reg-tests/http-messaging/connect_tunnels.vtc
index 2ee98a8a8..7770f448d 100644
--- a/reg-tests/http-messaging/connect_tunnels.vtc
+++ b/reg-tests/http-messaging/connect_tunnels.vtc
@@ -86,6 +86,10 @@ haproxy hap -conf {
listen fe_h2
bind "fd@${fe_h2}" proto h2
+ # c3 ends its stream with its tunneled data. abortonclose would abort
+ # the connection attempt if they arrived while it is in progress,
+ # which is not the case this scenario is about.
+ no option abortonclose
server s3 "${s3_addr}:${s3_port}"
listen fe_abrt
--
2.50.1 (Apple Git-155)