From 2d045597f7d3bfe781d4a948731bb6dc510bbdb8 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 28 Mar 2009 11:02:18 +0100 Subject: [PATCH] [BUG] reject unix accepts when connection limit is reached unix sockets are not attached to a real frontend, so there is no way to disable/enable the listener depending on the global session count. For this reason, if the global maxconn is reached and a unix socket comes in, it will just be ignored and remain in the poll list, which will call again indefinitely. So we need to accept then drop incoming unix connections when the table is full. This should not happen with clean configurations since the global maxconn should provide enough room for unix sockets. --- src/proto_uxst.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 599252a1f..8af3d5a63 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -368,7 +368,7 @@ int uxst_event_accept(int fd) { else max_accept = -1; - while (actconn < global.maxconn && max_accept--) { + while (max_accept--) { struct sockaddr_storage addr; socklen_t laddr = sizeof(addr); @@ -393,7 +393,7 @@ int uxst_event_accept(int fd) { } } - if (l->nbconn >= l->maxconn) { + if (l->nbconn >= l->maxconn || actconn >= global.maxconn) { /* too many connections, we shoot this one and return. * FIXME: it would be better to simply switch the listener's * state to LI_FULL and disable the FD. We could re-enable