--------------------- PatchSet 11513 Date: 2007/06/25 23:41:09 Author: hno Branch: SQUID_2_6 Tag: (none) Log: MFC: Temporary shortage of system filedescriptors may cause Squid to permanently 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. Merged changes: 2007/06/25 14:38:00 hno +3 -1 Bug #1798: Temporary shortage of system filedescriptors may cause Squid to permanently stop accepting connections Members: src/fd.c:1.55.2.1->1.55.2.2 Index: squid/src/fd.c =================================================================== RCS file: /cvsroot/squid/squid/src/fd.c,v retrieving revision 1.55.2.1 retrieving revision 1.55.2.2 diff -u -r1.55.2.1 -r1.55.2.2 --- squid/src/fd.c 22 Jun 2007 12:07:36 -0000 1.55.2.1 +++ squid/src/fd.c 25 Jun 2007 23:41:09 -0000 1.55.2.2 @@ -1,6 +1,6 @@ /* - * $Id: fd.c,v 1.55.2.1 2007/06/22 12:07:36 adrian Exp $ + * $Id: fd.c,v 1.55.2.2 2007/06/25 23:41:09 hno Exp $ * * DEBUG: section 51 Filedescriptor Functions * AUTHOR: Duane Wessels @@ -274,6 +274,8 @@ debug(51, 0) ("WARNING: This machine has a serious shortage of filedescriptors.\n"); new = x; } + if (Squid_MaxFD - new < XMIN(256, Squid_MaxFD / 2)) + fatalf("Too few filedescriptors available in the system (%d usable of %d).\n", Squid_MaxFD - new, Squid_MaxFD); debug(51, 0) ("Reserved FD adjusted from %d to %d due to failures\n", RESERVED_FD, new); RESERVED_FD = new;