]> git.kaiwu.me - haproxy.git/commit
[BUG] fix the dequeuing logic to ensure that all requests get served
authorWilly Tarreau <w@1wt.eu>
Fri, 20 Jun 2008 13:04:11 +0000 (15:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 20 Jun 2008 14:21:28 +0000 (16:21 +0200)
commit9919ae06c286af7b5b4c1c97808fdf14b7f37083
tree1d6819257b57b937a21c8e18f95b36cf369ac597
parent39b60808c858b519d1b0325429de856a3c1a9ef4
[BUG] fix the dequeuing logic to ensure that all requests get served

The dequeuing logic was completely wrong. First, a task was assigned
to all servers to process the queue, but this task was never scheduled
and was only woken up on session free. Second, there was no reservation
of server entries when a task was assigned a server. This means that
as long as the task was not connected to the server, its presence was
not accounted for. This was causing trouble when detecting whether or
not a server had reached maxconn. Third, during a redispatch, a session
could lose its place at the server's and get blocked because another
session at the same moment would have stolen the entry. Fourth, the
redispatch option did not work when maxqueue was reached for a server,
and it was not possible to do so without indefinitely hanging a session.

The root cause of all those problems was the lack of pre-reservation of
connections at the server's, and the lack of tracking of servers during
a redispatch. Everything relied on combinations of flags which could
appear similarly in quite distinct situations.

This patch is a major rework but there was no other solution, as the
internal logic was deeply flawed. The resulting code is cleaner, more
understandable, uses less magics and is overall more robust.

As an added bonus, "option redispatch" now works when maxqueue has
been reached on a server.
12 files changed:
include/proto/queue.h
include/proto/session.h
include/types/server.h
include/types/session.h
src/backend.c
src/cfgparse.c
src/client.c
src/haproxy.c
src/proto_http.c
src/proto_uxst.c
src/queue.c
src/session.c