------------------------------------------------------------ revno: 12336 revision-id: squid3@treenet.co.nz-20121002021850-wvm8h3xfhb7nmhwn parent: squid3@treenet.co.nz-20121002015536-3nwxl820hnhjgh1h fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=3130 committer: Amos Jeffries branch nick: trunk timestamp: Tue 2012-10-02 14:18:50 +1200 message: 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. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121002021850-wvm8h3xfhb7nmhwn # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: ee487b9a2f8ee066ff766744b559ebcfea6fcfe2 # timestamp: 2012-10-02 02:52:54 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20121002015536-\ # 3nwxl820hnhjgh1h # # Begin patch === modified file 'src/helper.cc' --- src/helper.cc 2012-10-02 01:55:36 +0000 +++ src/helper.cc 2012-10-02 02:18:50 +0000 @@ -738,8 +738,12 @@ 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 @@ 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);