]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Docs: display WARNING and ERROR when max_filedescriptors has failed.
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 20 May 2011 13:38:40 +0000 (01:38 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 20 May 2011 13:38:40 +0000 (01:38 +1200)
The big cases of missing OS dependencies and use of select() are mentioned
on configure parse where relevant. As well as from setMaxFD().

Failures to make the change are already logged, but now highlighted as
ERROR cases.

src/cache_cf.cc
src/tools.cc

index 236ad5af9bd879fa691d35a313d4d28fa93e8bf8..7796b1527387f3f9374bb35e5e57de4ccf73448b 100644 (file)
@@ -645,6 +645,16 @@ configDoConfigure(void)
     if (Config.errHtmlText == NULL)
         Config.errHtmlText = xstrdup(null_string);
 
+#if !HAVE_SETRLIMIT || !defined(RLIMIT_NOFILE)
+    if (Config.max_filedescriptors > 0) {
+        debugs(0, DBG_WARNING, "WARNING: max_filedescriptors disabled. Operating System setrlimit(RLIMIT_NOFILE) is missing.");
+    }
+#elif USE_SELECT || USE_SELECT_WIN32
+    if (Config.max_filedescriptors > FD_SETSIZE) {
+        debugs(0, DBG_WARNING, "WARNING: max_filedescriptors limited to " << FD_SETSIZE << " by select() algorithm.");
+    }
+#endif
+
     storeConfigure();
 
     snprintf(ThisCache, sizeof(ThisCache), "%s (%s)",
index e98d4e7ded1eea9797e09ded15f782d1e94b00d2..257b2864235441c9e734516a54b7409124dee7aa 100644 (file)
@@ -981,24 +981,25 @@ setMaxFD(void)
     } else if (Config.max_filedescriptors > 0) {
 #if USE_SELECT || USE_SELECT_WIN32
         /* select() breaks if this gets set too big */
-        if (Config.max_filedescriptors > FD_SETSIZE)
+        if (Config.max_filedescriptors > FD_SETSIZE) {
             rl.rlim_cur = FD_SETSIZE;
-        else
+            debugs(50, DBG_CRITICAL, "WARNING: 'max_filedescriptors " << Config.max_filedescriptors << "' does not work with select()");
+        } else
 #endif
             rl.rlim_cur = Config.max_filedescriptors;
         if (rl.rlim_cur > rl.rlim_max)
             rl.rlim_max = rl.rlim_cur;
         if (setrlimit(RLIMIT_NOFILE, &rl)) {
-            debugs(50, DBG_CRITICAL, "setrlimit: RLIMIT_NOFILE: " << xstrerror());
+            debugs(50, DBG_CRITICAL, "ERROR: setrlimit: RLIMIT_NOFILE: " << xstrerror());
             getrlimit(RLIMIT_NOFILE, &rl);
             rl.rlim_cur = rl.rlim_max;
             if (setrlimit(RLIMIT_NOFILE, &rl)) {
-                debugs(50, DBG_CRITICAL, "setrlimit: RLIMIT_NOFILE: " << xstrerror());
+                debugs(50, DBG_CRITICAL, "ERROR: setrlimit: RLIMIT_NOFILE: " << xstrerror());
             }
         }
     }
     if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
-        debugs(50, DBG_CRITICAL, "setrlimit: RLIMIT_NOFILE: " << xstrerror());
+        debugs(50, DBG_CRITICAL, "ERROR: getrlimit: RLIMIT_NOFILE: " << xstrerror());
     } else {
         Squid_MaxFD = rl.rlim_cur;
     }