Do not setup pipes between SERVER processes, they don't talk to each
authorflorian <florian@openbsd.org>
Sat, 4 Dec 2021 06:52:58 +0000 (06:52 +0000)
committerflorian <florian@openbsd.org>
Sat, 4 Dec 2021 06:52:58 +0000 (06:52 +0000)
other. Since this generates a full mesh, the amount of filedescriptors
needed grows quadratically with the amount of configured prefork
processes.

Might fix an out of filedescriptor bug that beck is seeing.
OK benno

usr.sbin/httpd/proc.c

index 2444d50..3d70181 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: proc.c,v 1.40 2021/04/20 21:11:56 dv Exp $    */
+/*     $OpenBSD: proc.c,v 1.41 2021/12/04 06:52:58 florian Exp $       */
 
 /*
  * Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
@@ -419,6 +419,10 @@ proc_open(struct privsep *ps, int src, int dst)
                        if (src == dst && i == j)
                                continue;
 
+                       /* Servers don't talk to each other. */
+                       if (src == PROC_SERVER && dst == PROC_SERVER)
+                               continue;
+
                        pa = &ps->ps_pipes[src][i];
                        pb = &ps->ps_pipes[dst][j];
                        if (socketpair(AF_UNIX,