]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[BUG] session: don't stop forwarding of data upon last packet
authorWilly Tarreau <w@1wt.eu>
Sun, 7 Nov 2010 19:26:56 +0000 (20:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Nov 2010 08:26:29 +0000 (09:26 +0100)
commitda4d9fe5a428b2819929a53a4266c8f78a1fb147
treefe40eb88be955aa4ea2489aeaf21088c94d6febd
parent62846b2674eb02e5790ddf52db6b856a2db39703
[BUG] session: don't stop forwarding of data upon last packet

If a read shutdown is encountered on the first packet of a connection
right after the data and the last analyser is unplugged at the same
time, then that last data chunk may never be forwarded. In practice,
right now it cannot happen on requests due to the way they're scheduled,
nor can it happen on responses due to the way their analysers work.

But this behaviour has been observed with new response analysers being
developped.

The reason is that when the read shutdown is encountered and an analyser
is present, data cannot be forwarded but the BF_SHUTW_NOW flag is set.
After that, the analyser gets called and unplugs itself, hoping that
process_session() will automatically forward the data. This does not
happen due to BF_SHUTW_NOW.

Simply removing the test on this flag is not enough because then aborted
requests still get forwarded, due to the forwarding code undoing the
abort.

The solution here consists in checking BF_SHUTR_NOW instead of BF_SHUTW_NOW.
BF_SHUTR_NOW is only set on aborts and remains set until ->shutr() is called.
This is enough to catch recent aborts but not prevent forwarding in other
cases. Maybe a new special buffer flag "BF_ABORT" might be desirable in the
future.

This patch does not need to be backported because older versions don't
have the analyser which make the problem appear.
src/session.c