From: Amos Jeffries Date: Sun, 29 May 2011 04:56:36 +0000 (-0600) Subject: Docs: display WARNING and ERROR when max_filedescriptors has failed. X-Git-Tag: SQUID_3_1_12_2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfd8683cb900658b34dbad4c5808a54163b36af2;p=thirdparty%2Fsquid.git Docs: display WARNING and ERROR when max_filedescriptors has failed. 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. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index fcbc93c017..56a6433853 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -501,6 +501,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_IMPORTANT, "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_IMPORTANT, "WARNING: max_filedescriptors limited to " << FD_SETSIZE << " by select() algorithm."); + } +#endif + storeConfigure(); snprintf(ThisCache, sizeof(ThisCache), "%s (%s)", diff --git a/src/tools.cc b/src/tools.cc index ad2c212b10..6feae60403 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -895,24 +895,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; }