Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 27238 invoked by uid 6000); 9 Nov 1997 09:32:45 -0000 Received: (qmail 27231 invoked from network); 9 Nov 1997 09:32:44 -0000 Received: from twinlark.arctic.org (204.62.130.91) by taz.hyperreal.org with SMTP; 9 Nov 1997 09:32:44 -0000 Received: (qmail 15330 invoked by uid 500); 9 Nov 1997 09:32:43 -0000 Date: Sun, 9 Nov 1997 01:32:43 -0800 (PST) From: Dean Gaudet To: new-httpd@apache.org Subject: [PATCH] PR#1181: diagnose low descriptor situations Message-ID: Organization: Transmeta Corp. MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org When an F_DUPFD fails to dup above the low slack line the server is in danger of having too few descriptors to function properly. We can diagnose this at config time... and this is likely to be far more useful to users than having them guess why things are randomly failing (like DNS or CGI spawning). Dean Index: main/util.c =================================================================== RCS file: /export/home/cvs/apachen/src/main/util.c,v retrieving revision 1.75 diff -u -r1.75 util.c --- util.c 1997/10/27 16:30:30 1.75 +++ util.c 1997/11/09 09:30:29 @@ -66,9 +66,7 @@ #include "httpd.h" #include "http_conf_globals.h" /* for user_id & group_id */ -#if defined(DEBUG)||defined(DEBUG_CFG_LINES) #include "http_log.h" -#endif #include const char month_snames[12][4] = @@ -1620,6 +1618,7 @@ #if !defined(F_DUPFD) return fd; #else + static int low_warned; int new_fd; #ifdef HIGH_SLACK_LINE @@ -1637,6 +1636,20 @@ } new_fd = fcntl(fd, F_DUPFD, LOW_SLACK_LINE); if (new_fd == -1) { + if (!low_warned) { + /* Give them a warning here, because we really can't predict + * how libraries and such are going to fail. If we can't + * do this F_DUPFD there's a good chance that apache has too + * few descriptors available to it. Note we don't warn on + * the high line, because if it fails we'll eventually try + * the low line... + */ + aplog_error(APLOG_MARK, APLOG_ERR, NULL, + "unable to open a file descriptor above %u, " + "you may need to increase the number of descriptors", + LOW_SLACK_LINE); + low_warned = 1; + } return fd; } close(fd);