]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: stream: fix session abort on resource shortage
authorWilly Tarreau <w@1wt.eu>
Sun, 4 Dec 2016 19:05:16 +0000 (20:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 4 Dec 2016 19:16:52 +0000 (20:16 +0100)
commit92b10c954defc82ceabdc9bba923320a157c664d
treee6a793767514c0c0ef4a29b45e574244cf722532
parent6962f4e0d6dd1f1e976f815c1c8afaabfadc93fa
BUG/MAJOR: stream: fix session abort on resource shortage

In 1.6-dev2, commit 32990b5 ("MEDIUM: session: remove the task pointer
from the session") introduced a bug which can sometimes crash the process
on resource shortage. When stream_complete() returns -1, it has already
reattached the connection to the stream, then kill_mini_session() is
called and still expects to find the task in conn->owner. Note that
since this commit, the code has moved a bit and is now in stream_new()
but the problem remains the same.

Given that we already know the task around these places, let's simply
pass the task to kill_mini_session().

The conditions currently at risk are :
  - failure to initialize filters for the new stream (lack of memory or
    any filter returning < 0 on attach())
  - failure to attach filters (any filter returning < 0 on stream_start())
  - frontend's accept() returning < 0 (allocation failure)

This fix is needed in 1.7 and 1.6.
src/session.c