From: Amos Jeffries Date: Tue, 2 Oct 2012 02:18:50 +0000 (+1200) Subject: Bug 3130: helpers are crashing too rapidly X-Git-Tag: SQUID_3_3_0_1~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72e820efb8128e5249fbc41b4d9e11c1affc06ae;p=thirdparty%2Fsquid.git Bug 3130: helpers are crashing too rapidly As discussed quite many months ago. This reduces the FATAL when helpers crash/exit to a critical level ERROR have responded with useful reply to at least one lookup. The result is that Squid can now cope with helpers written in languages which cannot loop infinitely. For example; PHP helpers often exit after a timeout, broken scripts written to respond and exit immediately, and helpers which encounter some permissions error and respond only with "ERR" or "BH" results before aborting. --- diff --git a/src/helper.cc b/src/helper.cc index c5287607e8..73c4b8855f 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -738,8 +738,12 @@ helperServerFree(helper_server *srv) if (hlp->childs.needNew() > 0) { debugs(80, DBG_IMPORTANT, "Too few " << hlp->id_name << " processes are running (need " << hlp->childs.needNew() << "/" << hlp->childs.n_max << ")"); - if (hlp->childs.n_active < hlp->childs.n_startup && hlp->last_restart > squid_curtime - 30) - fatalf("The %s helpers are crashing too rapidly, need help!\n", hlp->id_name); + if (hlp->childs.n_active < hlp->childs.n_startup && hlp->last_restart > squid_curtime - 30) { + if (srv->stats.replies < 1) + fatalf("The %s helpers are crashing too rapidly, need help!\n", hlp->id_name); + else + debugs(80, DBG_CRITICAL, "ERROR: The " << hlp->id_name << " helpers are crashing too rapidly, need help!"); + } debugs(80, DBG_IMPORTANT, "Starting new helpers"); helperOpenServers(hlp); @@ -799,8 +803,12 @@ helperStatefulServerFree(helper_stateful_server *srv) if (hlp->childs.needNew() > 0) { debugs(80, DBG_IMPORTANT, "Too few " << hlp->id_name << " processes are running (need " << hlp->childs.needNew() << "/" << hlp->childs.n_max << ")"); - if (hlp->childs.n_active < hlp->childs.n_startup && hlp->last_restart > squid_curtime - 30) - fatalf("The %s helpers are crashing too rapidly, need help!\n", hlp->id_name); + if (hlp->childs.n_active < hlp->childs.n_startup && hlp->last_restart > squid_curtime - 30) { + if (srv->stats.replies < 1) + fatalf("The %s helpers are crashing too rapidly, need help!\n", hlp->id_name); + else + debugs(80, DBG_CRITICAL, "ERROR: The " << hlp->id_name << " helpers are crashing too rapidly, need help!"); + } debugs(80, DBG_IMPORTANT, "Starting new helpers"); helperStatefulOpenServers(hlp);