From: Jeff Trawick Date: Fri, 7 Jul 2000 15:20:35 +0000 (+0000) Subject: Drastically increase the listen backlog for mod_cgid's unix socket. It X-Git-Tag: APACHE_2_0_ALPHA_5~161 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7952200e83d68772c4fc25e1cbb5a82eeebdf0cb;p=thirdparty%2Fapache%2Fhttpd.git Drastically increase the listen backlog for mod_cgid's unix socket. It 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 --- diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index 423f6a4148f..bd3785ab812 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -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;