Frédéric Lécaille | 233afc7 | 2018-09-04 15:58:14 +0200 | [diff] [blame] | 1 | # commit 70d318c |
| 2 | # BUG/MEDIUM: lua: possible CLOSE-WAIT state with '\n' headers |
| 3 | # |
| 4 | # The Lua parser doesn't takes in account end-of-headers containing |
| 5 | # only '\n'. It expects always '\r\n'. If a '\n' is processes the Lua |
| 6 | # parser considers it miss 1 byte, and wait indefinitely for new data. |
| 7 | # |
| 8 | # When the client reaches their timeout, it closes the connection. |
| 9 | # This close is not detected and the connection keep in CLOSE-WAIT |
| 10 | # state. |
| 11 | # |
| 12 | # I guess that this patch fix only a visible part of the problem. |
| 13 | # If the Lua HTTP parser wait for data, the timeout server or the |
| 14 | # connectio closed by the client may stop the applet. |
| 15 | |
| 16 | varnishtest "possible CLOSE-WAIT with '\n' headers" |
Christopher Faulet | fdafd9a | 2018-12-19 11:50:17 +0100 | [diff] [blame] | 17 | #REQUIRE_OPTIONS=LUA |
Frédéric Lécaille | dc1a3bd | 2019-03-29 15:07:24 +0100 | [diff] [blame] | 18 | #REGTEST_TYPE=bug |
Frédéric Lécaille | 233afc7 | 2018-09-04 15:58:14 +0200 | [diff] [blame] | 19 | |
| 20 | feature ignore_unknown_macro |
| 21 | |
| 22 | syslog Slog -level info -repeat 100 { |
| 23 | recv info |
Christopher Faulet | c423030 | 2019-04-01 11:17:40 +0200 | [diff] [blame] | 24 | 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]*" |
Frédéric Lécaille | 233afc7 | 2018-09-04 15:58:14 +0200 | [diff] [blame] | 25 | } -start |
| 26 | |
| 27 | haproxy h1 -conf { |
| 28 | defaults |
| 29 | timeout client 1s |
| 30 | timeout connect 1s |
| 31 | |
| 32 | global |
Frédéric Lécaille | b894f92 | 2019-03-29 16:13:48 +0100 | [diff] [blame] | 33 | lua-load ${testdir}/close_wait_lf.lua |
Frédéric Lécaille | 233afc7 | 2018-09-04 15:58:14 +0200 | [diff] [blame] | 34 | |
| 35 | frontend frt |
| 36 | log ${Slog_addr}:${Slog_port} local0 debug err |
| 37 | log-format Ta=%Ta\ Tc=%Tc\ Td=%Td\ Th=%Th\ Ti=%Ti\ Tq=%Tq\ TR=%TR\ Tr=%Tr\ Tt=%Tt\ Tw=%Tw |
| 38 | mode http |
Christopher Faulet | 8f16148 | 2018-12-19 11:49:39 +0100 | [diff] [blame] | 39 | ${no-htx} option http-use-htx |
Frédéric Lécaille | 233afc7 | 2018-09-04 15:58:14 +0200 | [diff] [blame] | 40 | bind "fd@${frt}" |
| 41 | http-request use-service lua.donothing |
| 42 | } -start |
| 43 | |
| 44 | |
| 45 | client c1 -connect ${h1_frt_sock} -repeat 100 { |
| 46 | send "GET / HTTP/1.1\n\n" |
| 47 | } -run |
| 48 | |
| 49 | syslog Slog -wait |
| 50 | |
| 51 | shell { |
Christopher Faulet | ce4ec50 | 2019-04-01 15:39:50 +0200 | [diff] [blame] | 52 | ss -pt | grep CLOSE-WAIT.*haproxy.*pid=${h1_pid} |
Frédéric Lécaille | 233afc7 | 2018-09-04 15:58:14 +0200 | [diff] [blame] | 53 | exit $((!$?)) |
| 54 | } |