]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1798: Temporary shortage of system filedescriptors may cause Squid to perma
authorhno <>
Mon, 25 Jun 2007 20:38:14 +0000 (20:38 +0000)
committerhno <>
Mon, 25 Jun 2007 20:38:14 +0000 (20:38 +0000)
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.

src/fd.cc

index 466a3ac0cc82ce822ac62acb2616b00503151695..86ca0e93539625fa8eae72534281ca9fff12c299 100644 (file)
--- 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;
 }