]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[BUG] stream_sock: disable listener when system resources are exhausted
authorWilly Tarreau <w@1wt.eu>
Fri, 22 Jul 2011 14:56:33 +0000 (16:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 24 Jul 2011 14:16:14 +0000 (16:16 +0200)
commit100298749bb45789fd1d7bc8c1c7f3ac3f6d504d
treee58ee1df8d095b748dda472582329165511c961e
parent4827fd2a7e695fef467004174c60e3d2aa03fc1c
[BUG] stream_sock: disable listener when system resources are exhausted

When an accept() returns -1 ENFILE du to system limits, it leaves the
connection pending in the backlog and epoll() comes back immediately
afterwards trying to make it accept it again. This causes haproxy to
remain at 100% CPU until something makes an accept() possible again.
Now upon such resource shortage, we mark the listener FULL so that we
only enable it again once at least one connection has been released.
In fact we only do that if there are some active connections on this
proxy, so that it has a chance to be marked not full again. This makes
haproxy remain idle when all resources are used, which helps a lot
releasing those resource as fast as possible.

Backport to 1.4 might be desirable but difficult and tricky.
src/stream_sock.c