From: Amos Jeffries Date: Mon, 10 Oct 2011 03:28:26 +0000 (-0600) Subject: Bug 3336: assertion failed: helper.cc:701: 'hlp->childs.n_running > 0' X-Git-Tag: BumpSslServerFirst.take01~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1af735c75a5d3b42999ac38bf7d945858f6e0ac7;p=thirdparty%2Fsquid.git Bug 3336: assertion failed: helper.cc:701: 'hlp->childs.n_running > 0' --- diff --git a/src/HelperChildConfig.cc b/src/HelperChildConfig.cc index 69f0b3b640..85fdf0ebd7 100644 --- a/src/HelperChildConfig.cc +++ b/src/HelperChildConfig.cc @@ -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; } diff --git a/src/HelperChildConfig.h b/src/HelperChildConfig.h index 06c507fd93..a6ee398029 100644 --- a/src/HelperChildConfig.h +++ b/src/HelperChildConfig.h @@ -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: diff --git a/src/auth/basic/auth_basic.cc b/src/auth/basic/auth_basic.cc index 85ae452b8e..ff150c3e35 100644 --- a/src/auth/basic/auth_basic.cc +++ b/src/auth/basic/auth_basic.cc @@ -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; diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index 64e374b42b..f96dea9f04 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -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; diff --git a/src/auth/negotiate/auth_negotiate.cc b/src/auth/negotiate/auth_negotiate.cc index 2496421656..b1ad1cba7a 100644 --- a/src/auth/negotiate/auth_negotiate.cc +++ b/src/auth/negotiate/auth_negotiate.cc @@ -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; diff --git a/src/auth/ntlm/auth_ntlm.cc b/src/auth/ntlm/auth_ntlm.cc index d84bd0c9fd..60541d451b 100644 --- a/src/auth/ntlm/auth_ntlm.cc +++ b/src/auth/ntlm/auth_ntlm.cc @@ -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; diff --git a/src/dns.cc b/src/dns.cc index 1935cee427..984fdfca11 100644 --- a/src/dns.cc +++ b/src/dns.cc @@ -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; diff --git a/src/external_acl.cc b/src/external_acl.cc index d0a9dd63a5..d14abdc6ee 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -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; diff --git a/src/redirect.cc b/src/redirect.cc index 05d36f4061..7cb6bdeccb 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -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; diff --git a/src/ssl/helper.cc b/src/ssl/helper.cc index 974f62cadc..b6e16e9fea 100644 --- a/src/ssl/helper.cc +++ b/src/ssl/helper.cc @@ -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.