BUG/MINOR: mux_h2: reject passive reverse conn if error on add to idle

On passive reverse, H2 mux is responsible to insert the connection in
the server idle list. This is done via srv_add_to_idle_list(). However,
this function may fail for various reason, such as FD usage limit
reached.

Handle properly this error case. H2 mux flags the connection on error
which will cause its release. Prior to this patch, the connection was
only released on server timeout.

This bug was found inspecting server curr_used_conns counter. Indeed, on
connection reverse, this counter is first incremented. It is decremented
just after on srv_add_to_idle_list() if insertion is validated. However,
if insertion is rejected, the connection was not released which cause
curr_used_conns to remains positive. This has the major downside to
break the reusing of idle connection on rhttp causing spurrious 503
errors.

No need to backport.
This commit is contained in:
Amaury Denoyelle 2023-11-16 17:13:41 +01:00
parent 8cc3fc73f1
commit a1457296d5

View File

@ -3295,7 +3295,8 @@ static int h2_conn_reverse(struct h2c *h2c)
HA_ATOMIC_OR(&h2c->wait_event.tasklet->state, TASK_F_USR1);
xprt_set_idle(conn, conn->xprt, conn->xprt_ctx);
srv_add_to_idle_list(srv, conn, 1);
if (!srv_add_to_idle_list(srv, conn, 1))
goto err;
}
else {
struct listener *l = __objt_listener(h2c->conn->target);