From: hno <> Date: Mon, 25 Jun 2007 20:38:14 +0000 (+0000) Subject: Bug #1798: Temporary shortage of system filedescriptors may cause Squid to perma X-Git-Tag: SQUID_3_0_PRE7~188 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=375295ebbb8736415fa7c19b6e456810777e1c99;p=thirdparty%2Fsquid.git Bug #1798: Temporary shortage of system filedescriptors may cause Squid to perma nently stop accepting connections To adjust to system limits Squid automatically reduces the amount of filedescriptors when it detects a system wide shortage. However, this reduction might go so far that Squid completely stops accepting new connections. This patch adds a limit causing Squid to restart if the limit gets way too low, in an attempt to recover if the situation is temporary. --- diff --git a/src/fd.cc b/src/fd.cc index 466a3ac0cc..86ca0e9353 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -1,6 +1,6 @@ /* - * $Id: fd.cc,v 1.57 2007/04/28 22:26:37 hno Exp $ + * $Id: fd.cc,v 1.58 2007/06/25 14:38:14 hno Exp $ * * DEBUG: section 51 Filedescriptor Functions * AUTHOR: Duane Wessels @@ -326,6 +326,9 @@ fdAdjustReserved(void) newReserve = x; } + if (Squid_MaxFD - newReserve < XMIN(256, Squid_MaxFD / 2)) + fatalf("Too few filedescriptors available in the system (%d usable of %d).\n", Squid_MaxFD - newReserve, Squid_MaxFD); + debugs(51, 0, "Reserved FD adjusted from " << RESERVED_FD << " to " << newReserve << " due to failures"); RESERVED_FD = newReserve; }