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" |
| 17 | |
| 18 | feature ignore_unknown_macro |
| 19 | |
| 20 | syslog Slog -level info -repeat 100 { |
| 21 | recv info |
Willy Tarreau | 9c27ea0 | 2018-11-16 15:54:23 +0100 | [diff] [blame] | 22 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Ta=[0-9]* Tc=[0-9]* Td=-1 Th=[0-9]* Ti=[0-9]* Tq=[0-9]* TR=[0-9] Tr=-1 Tt=[0-9]* Tw=[0-9]*" |
Frédéric Lécaille | 233afc7 | 2018-09-04 15:58:14 +0200 | [diff] [blame] | 23 | } -start |
| 24 | |
| 25 | haproxy h1 -conf { |
| 26 | defaults |
| 27 | timeout client 1s |
| 28 | timeout connect 1s |
| 29 | |
| 30 | global |
| 31 | lua-load ${testdir}/b00003.lua |
| 32 | nbthread 4 |
| 33 | |
| 34 | frontend frt |
| 35 | log ${Slog_addr}:${Slog_port} local0 debug err |
| 36 | log-format Ta=%Ta\ Tc=%Tc\ Td=%Td\ Th=%Th\ Ti=%Ti\ Tq=%Tq\ TR=%TR\ Tr=%Tr\ Tt=%Tt\ Tw=%Tw |
| 37 | mode http |
| 38 | bind "fd@${frt}" |
| 39 | http-request use-service lua.donothing |
| 40 | } -start |
| 41 | |
| 42 | |
| 43 | client c1 -connect ${h1_frt_sock} -repeat 100 { |
| 44 | send "GET / HTTP/1.1\n\n" |
| 45 | } -run |
| 46 | |
| 47 | syslog Slog -wait |
| 48 | |
| 49 | shell { |
| 50 | ss -pt | grep CLOSE-WAIT.*haproxy |
| 51 | exit $((!$?)) |
| 52 | } |