]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3336: assertion failed: helper.cc:701: 'hlp->childs.n_running > 0'
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 10 Oct 2011 03:28:26 +0000 (21:28 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 10 Oct 2011 03:28:26 +0000 (21:28 -0600)
src/HelperChildConfig.cc
src/HelperChildConfig.h
src/auth/basic/auth_basic.cc
src/auth/digest/auth_digest.cc
src/auth/negotiate/auth_negotiate.cc
src/auth/ntlm/auth_ntlm.cc
src/dns.cc
src/external_acl.cc
src/redirect.cc
src/ssl/helper.cc

index 69f0b3b640c05c5aae1e66b35cc06dd8131a0c1b..85fdf0ebd7f4e6d7a96801cfa350f452d94cb62e 100644 (file)
@@ -19,7 +19,25 @@ HelperChildConfig::~HelperChildConfig()
 HelperChildConfig &
 HelperChildConfig::operator =(const HelperChildConfig &rhs)
 {
-    memcpy(this, &rhs, sizeof(HelperChildConfig));
+    // Copies everything.
+    n_max = rhs.n_max;
+    n_startup = rhs.n_startup;
+    n_idle = rhs.n_idle;
+    concurrency = rhs.concurrency;
+    n_running = rhs.n_running;
+    n_active = rhs.n_active;
+    return *this;
+}
+
+HelperChildConfig &
+HelperChildConfig::updateLimits(const HelperChildConfig &rhs)
+{
+    // Copy the limits only.
+    // Preserve the local state values (n_running and n_active)
+    n_max = rhs.n_max;
+    n_startup = rhs.n_startup;
+    n_idle = rhs.n_idle;
+    concurrency = rhs.concurrency;
     return *this;
 }
 
index 06c507fd93c3782428f3cdff3e9819ed6b17a247..a6ee3980295b7bedcc210887a4d1bad3ecd78280 100644 (file)
@@ -14,7 +14,7 @@ public:
     ~HelperChildConfig();
     HelperChildConfig &operator =(const HelperChildConfig &rhs);
 
-    /*
+    /**
      * When new helpers are needed call this to find out how many more
      * we are allowed to start.
      * \retval 0       No more helpers may be started right now.
@@ -24,6 +24,13 @@ public:
     int needNew() const;
     void parseConfig();
 
+    /**
+     * Update an existing set of details with new start/max/idle/concurrent limits.
+     * This is for parsing new child settings into an object incrementally then updating
+     * the running set without loosing any of the active state or causing races.
+     */
+    HelperChildConfig &updateLimits(const HelperChildConfig &rhs);
+
     /* values from squid.conf */
 public:
 
index 85ae452b8ec51a593879a9fdcd6852eed4f45b5d..ff150c3e3591a02f5aa7339a7780ff963fffc5c3 100644 (file)
@@ -354,7 +354,7 @@ Auth::Basic::Config::init(Auth::Config * schemeCfg)
 
         basicauthenticators->cmdline = authenticateProgram;
 
-        basicauthenticators->childs = authenticateChildren;
+        basicauthenticators->childs.updateLimits(authenticateChildren);
 
         basicauthenticators->ipc_type = IPC_STREAM;
 
index 64e374b42bf76133837b659c23e5898dc9ed7ebd..f96dea9f04899b78bafb4e26cd359139533bf486 100644 (file)
@@ -583,7 +583,7 @@ Auth::Digest::Config::init(Auth::Config * scheme)
 
         digestauthenticators->cmdline = authenticateProgram;
 
-        digestauthenticators->childs = authenticateChildren;
+        digestauthenticators->childs.updateLimits(authenticateChildren);
 
         digestauthenticators->ipc_type = IPC_STREAM;
 
index 2496421656aecceca579f7f9c30265469e68055e..b1ad1cba7a566bbc49251f541ce281a283fcbe5c 100644 (file)
@@ -176,7 +176,7 @@ Auth::Negotiate::Config::init(Auth::Config * scheme)
 
         negotiateauthenticators->cmdline = authenticateProgram;
 
-        negotiateauthenticators->childs = authenticateChildren;
+        negotiateauthenticators->childs.updateLimits(authenticateChildren);
 
         negotiateauthenticators->ipc_type = IPC_STREAM;
 
index d84bd0c9fd2b0c0886aff97b75b17300f0c8da20..60541d451b88f1cdf72353351942f945f915e521 100644 (file)
@@ -163,7 +163,7 @@ Auth::Ntlm::Config::init(Auth::Config * scheme)
 
         ntlmauthenticators->cmdline = authenticateProgram;
 
-        ntlmauthenticators->childs = authenticateChildren;
+        ntlmauthenticators->childs.updateLimits(authenticateChildren);
 
         ntlmauthenticators->ipc_type = IPC_STREAM;
 
index 1935cee427c0c22253e3792e1ae1aded075d677e..984fdfca111423ca268ffcb1d71e3d8a9c3a0631 100644 (file)
@@ -74,7 +74,7 @@ dnsInit(void)
     if (dnsservers == NULL)
         dnsservers = new helper("dnsserver");
 
-    dnsservers->childs = Config.dnsChildren;
+    dnsservers->childs.updateLimits(Config.dnsChildren);
 
     dnsservers->ipc_type = IPC_STREAM;
 
index d0a9dd63a5460e88eb72ccc870e1ab653d105130..d14abdc6ee79e24f35c30e36645890e2adda4f33 100644 (file)
@@ -1522,7 +1522,7 @@ externalAclInit(void)
 
         p->theHelper->cmdline = p->cmdline;
 
-        p->theHelper->childs = p->children;
+        p->theHelper->childs.updateLimits(p->children);
 
         p->theHelper->ipc_type = IPC_TCP_SOCKET;
 
index 05d36f4061837371d6120340bb45a2abde6fd949..7cb6bdeccba4920b49c50cbf25e147199b78b396 100644 (file)
@@ -251,7 +251,7 @@ redirectInit(void)
 
     redirectors->cmdline = Config.Program.redirect;
 
-    redirectors->childs = Config.redirectChildren;
+    redirectors->childs.updateLimits(Config.redirectChildren);
 
     redirectors->ipc_type = IPC_STREAM;
 
index 974f62cadc35fcbd8a21a247763f69ba85c51fff..b6e16e9fea61046fddd3436ed211d4d8069ce177 100644 (file)
@@ -40,7 +40,7 @@ void Ssl::Helper::Init()
         return;
 
     ssl_crtd = new helper("ssl_crtd");
-    ssl_crtd->childs = Ssl::TheConfig.ssl_crtdChildren;
+    ssl_crtd->childs.updateLimits(Ssl::TheConfig.ssl_crtdChildren);
     ssl_crtd->ipc_type = IPC_STREAM;
     // The crtd messages may contain the eol ('\n') character. We are
     // going to use the '\1' char as the end-of-message mark.