]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Drastically increase the listen backlog for mod_cgid's unix socket. It
authorJeff Trawick <trawick@apache.org>
Fri, 7 Jul 2000 15:20:35 +0000 (15:20 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 7 Jul 2000 15:20:35 +0000 (15:20 +0000)
was pretty easy to hit ECONNREFUSED errors when the backlog was 5.

The backlog can be customized at build time if required.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85787 13f79535-47bb-0310-9956-ffa450edef68

modules/generators/mod_cgid.c

index 423f6a4148f2eb5a8dedd9c863feb935cb3d9365..bd3785ab81239daa9016f319dee49eaba54b7f9f 100644 (file)
@@ -124,6 +124,17 @@ static int is_scriptaliased(request_rec *r)
 
 #define SHELL_PATH "/bin/sh"
 
+/* DEFAULT_CGID_LISTENBACKLOG controls the max depth on the unix socket's
+ * pending connection queue.  If a bunch of cgi requests arrive at about
+ * the same time, connections from httpd threads/processes will back up
+ * in the queue while the cgid process slowly forks off a child to process
+ * each connection on the unix socket.  If the queue is too short, the
+ * httpd process will get ECONNREFUSED when trying to connect.
+ */
+#ifndef DEFAULT_CGID_LISTENBACKLOG
+#define DEFAULT_CGID_LISTENBACKLOG 100
+#endif
+
 typedef struct { 
     const char *sockname;
     const char *logname; 
@@ -531,9 +542,8 @@ static int cgid_server(void *data)
                      sconf->sockname); 
         return errno;
     } 
-    /* Most implementations silently enforce a value of 5 anyway.  
-     * This way, it'll work the same everywhere. */
-    if (listen(sd, 5) < 0) {
+
+    if (listen(sd, DEFAULT_CGID_LISTENBACKLOG) < 0) {
         ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, 
                      "Couldn't listen on unix domain socket"); 
         return errno;