]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: session: ensure that we don't retry connection if some data were sent
authorWilly Tarreau <w@1wt.eu>
Mon, 29 Oct 2012 21:41:31 +0000 (22:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 29 Oct 2012 22:31:04 +0000 (23:31 +0100)
commite3224e870f335b04e1eca4e2b74b1974ab063cff
tree04ca60536981e041ed25f3f7d80ff00df3a560f7
parented7f836f07d36f5b0d096b369e6c0c3604c9dbbe
BUG/MINOR: session: ensure that we don't retry connection if some data were sent

With extra-large buffers, it is possible that a lot of data are sent upon
connection establishment before the session is notified. The issue is how
to handle a send() error after some data were actually sent.

At the moment, only a connection error is reported, causing a new connection
attempt and send() to restart after the last data. We absolutely don't want
to retry the connect() if at least one byte was sent, because those data are
lost.

The solution consists in reporting exactly what happens, which is :
  - a successful connection attempt
  - a read/write error on the channel

That way we go on with sess_establish(), the response analysers are called
and report the appropriate connection state for the error (typically a server
abort while waiting for a response). This mechanism also guarantees that we
won't retry since it's a success. The logs also report the correct connect
time.

Note that 1.4 is not directly affected because it only attempts one send(),
so it cannot detect a send() failure here and distinguish it form a failed
connection attempt. So no backport is needed. Also, this is just a safe belt
we're taking, since this issue should not happen anymore since previous commit.
src/session.c