Relayd has a limit of 1024 session per relay process. This is not enough
on busy web proxies with decent keep-alive usage. Once the limit is
reached new sessions are just dropped with makes the situation worse.
Since relayd already handles out of file descriptor situation more
gracefully I see no need to keep this artifical limit around.

The following diff removes RELAY_MAX_SESSIONS, OK?
-- 
:wq Claudio

Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/relayd/parse.y,v
retrieving revision 1.221
diff -u -p -r1.221 parse.y
--- parse.y     29 Nov 2017 15:24:50 -0000      1.221
+++ parse.y     15 Apr 2018 11:29:18 -0000
@@ -1081,7 +1081,7 @@ tcpflags  : SACK                  { proto->tcpflags |= T
                | SPLICE                { /* default */ }
                | NO SPLICE             { proto->tcpflags |= TCPFLAG_NSPLICE; }
                | BACKLOG NUMBER        {
-                       if ($2 < 0 || $2 > RELAY_MAX_SESSIONS) {
+                       if ($2 < 0 || $2 > 512) {
                                yyerror("invalid backlog: %d", $2);
                                YYERROR;
                        }
Index: relay.c
===================================================================
RCS file: /cvs/src/usr.sbin/relayd/relay.c,v
retrieving revision 1.237
diff -u -p -r1.237 relay.c
--- relay.c     27 Dec 2017 15:53:30 -0000      1.237
+++ relay.c     15 Apr 2018 11:29:18 -0000
@@ -1077,8 +1077,7 @@ relay_accept(int fd, short event, void *
                }
                return;
        }
-       if (relay_sessions >= RELAY_MAX_SESSIONS ||
-           rlay->rl_conf.flags & F_DISABLE)
+       if (rlay->rl_conf.flags & F_DISABLE)
                goto err;
 
        if ((con = calloc(1, sizeof(*con))) == NULL)
Index: relay_udp.c
===================================================================
RCS file: /cvs/src/usr.sbin/relayd/relay_udp.c,v
retrieving revision 1.47
diff -u -p -r1.47 relay_udp.c
--- relay_udp.c 4 Jul 2017 19:59:51 -0000       1.47
+++ relay_udp.c 15 Apr 2018 11:29:19 -0000
@@ -191,8 +191,7 @@ relay_udp_response(int fd, short sig, vo
                return;
        }
 
-       if (relay_sessions >= RELAY_MAX_SESSIONS ||
-           rlay->rl_conf.flags & F_DISABLE)
+       if (rlay->rl_conf.flags & F_DISABLE)
                return;
 
        slen = sizeof(ss);
@@ -226,8 +225,7 @@ relay_udp_server(int fd, short sig, void
 
        event_add(&rlay->rl_ev, NULL);
 
-       if (relay_sessions >= RELAY_MAX_SESSIONS ||
-           rlay->rl_conf.flags & F_DISABLE)
+       if (rlay->rl_conf.flags & F_DISABLE)
                return;
 
        slen = sizeof(ss);
Index: relayd.h
===================================================================
RCS file: /cvs/src/usr.sbin/relayd/relayd.h,v
retrieving revision 1.248
diff -u -p -r1.248 relayd.h
--- relayd.h    28 Nov 2017 18:25:53 -0000      1.248
+++ relayd.h    15 Apr 2018 11:29:19 -0000
@@ -68,7 +68,6 @@
 
 #define FD_RESERVE             5
 
-#define RELAY_MAX_SESSIONS     1024
 #define RELAY_TIMEOUT          600
 #define RELAY_CACHESIZE                -1      /* use default size */
 #define RELAY_NUMPROC          3

Reply via email to