haproxy/reg-tests/lua/close_wait_lf.vtc
Willy Tarreau f673923629 REGTESTS: extend the default I/O timeouts and make them overridable
With the CI occasionally slowing down, we're starting to see again some
spurious failures despite the long 1-second timeouts. This reports false
positives that are disturbing and doesn't provide as much value as this
could. However at this delay it already becomes a pain for developers
to wait for the tests to complete.

This commit adds support for the new environment variable
HAPROXY_TEST_TIMEOUT that will allow anyone to modify the connect,
client and server timeouts. It was set to 5 seconds by default, which
should be plenty for quite some time in the CI. All relevant values
that were 200ms or above were replaced by this one. A few larger
values were left as they are special. One test for the set-timeout
action that used to rely on a fixed 1-sec value was extended to a
fixed 5-sec, as the timeout is normally not reached, but it needs
to be known to compare the old and new values.
2021-11-18 17:57:11 +01:00

54 lines
1.6 KiB
Plaintext

# commit 70d318c
# BUG/MEDIUM: lua: possible CLOSE-WAIT state with '\n' headers
#
# The Lua parser doesn't takes in account end-of-headers containing
# only '\n'. It expects always '\r\n'. If a '\n' is processes the Lua
# parser considers it miss 1 byte, and wait indefinitely for new data.
#
# When the client reaches their timeout, it closes the connection.
# This close is not detected and the connection keep in CLOSE-WAIT
# state.
#
# I guess that this patch fix only a visible part of the problem.
# If the Lua HTTP parser wait for data, the timeout server or the
# connectio closed by the client may stop the applet.
varnishtest "possible CLOSE-WAIT with '\n' headers"
#REQUIRE_OPTIONS=LUA
#REGTEST_TYPE=bug
feature ignore_unknown_macro
syslog Slog -level info -repeat 100 {
recv info
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Ta=[0-9]* Tc=[0-9]* Td=[0-9]* Th=[0-9]* Ti=[0-9]* Tq=[0-9]* TR=[0-9]* Tr=[0-9]* Tt=[0-9]* Tw=[0-9]*"
} -start
haproxy h1 -conf {
defaults
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
global
lua-load ${testdir}/close_wait_lf.lua
frontend frt
log ${Slog_addr}:${Slog_port} local0 debug err
log-format Ta=%Ta\ Tc=%Tc\ Td=%Td\ Th=%Th\ Ti=%Ti\ Tq=%Tq\ TR=%TR\ Tr=%Tr\ Tt=%Tt\ Tw=%Tw
mode http
bind "fd@${frt}"
http-request use-service lua.donothing
} -start
client c1 -connect ${h1_frt_sock} -repeat 100 {
send "GET / HTTP/1.1\n\n"
} -run
syslog Slog -wait
shell {
ss -pt | grep CLOSE-WAIT.*haproxy.*pid=${h1_pid}
exit $((!$?))
}