2018-09-04 15:58:14 +02:00
# 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"
2018-12-19 11:50:17 +01:00
#REQUIRE_OPTIONS=LUA
2019-03-29 15:07:24 +01:00
#REGTEST_TYPE=bug
2018-09-04 15:58:14 +02:00
feature ignore_unknown_macro
syslog Slog -level info -repeat 100 {
recv info
2019-04-01 11:17:40 +02:00
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]*"
2018-09-04 15:58:14 +02:00
} -start
haproxy h1 -conf {
defaults
timeout client 1s
timeout connect 1s
global
2019-03-29 16:13:48 +01:00
lua-load ${testdir}/close_wait_lf.lua
2018-09-04 15:58:14 +02:00
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
2018-12-19 11:49:39 +01:00
${no-htx} option http-use-htx
2018-09-04 15:58:14 +02:00
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 {
2019-04-01 15:39:50 +02:00
ss -pt | grep CLOSE-WAIT.*haproxy.*pid=${h1_pid}
2018-09-04 15:58:14 +02:00
exit $((!$?))
}