BUG/MEDIUM: mux-h2: wait for the mux buffer to be empty before closing the connection
authorWilly Tarreau <w@1wt.eu>
Thu, 31 Jan 2019 17:48:20 +0000 (18:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 31 Jan 2019 18:38:25 +0000 (19:38 +0100)
commit4dbda620f2872b33aefc8c87ac34f7c71dbd1701
tree1129cac11be3b2fd7a04cb9b270d305cc332daf8
parent28e581b21c8229aa50b7e45148dd46fa6f43da5e
BUG/MEDIUM: mux-h2: wait for the mux buffer to be empty before closing the connection

When finishing to respond on a stream, a shutw() is called (resulting
in either an end of stream or RST), then h2_detach() is called, and may
decide to kill the connection is a number of conditions are satisfied.
Actually one of these conditions is that a GOAWAY frame was already sent
or attempted to be sent. This one is wrong, because it can happen in at
least these two situations :
  - a shutw() sends a GOAWAY to obey tcp-request content reject
  - a graceful shutdown is pending

In both cases, the connection will be aborted with the mux buffer holding
some data. In case of a strong abort the client will not see the GOAWAY or
RST and might want to try again, which is counter-productive. In case of
the graceful shutdown, it could result in truncated data. It looks like a
valid candidate for the issue reported here :

    https://www.mail-archive.com/haproxy@formilux.org/msg32433.html

A backport to 1.9 and 1.8 is necessary.
src/mux_h2.c