]> granicus.if.org Git - apache/commitdiff
mod_proxy_balancer: follow up to r1830800.
authorYann Ylavic <ylavic@apache.org>
Wed, 9 May 2018 01:23:59 +0000 (01:23 +0000)
committerYann Ylavic <ylavic@apache.org>
Wed, 9 May 2018 01:23:59 +0000 (01:23 +0000)
Don't call slotmem_attach() if the slot is already initialized/reused, that
used to work previously because the returned error status is ignored, but
r1830800 changed the function to forcibly reset the returned slot pointer to
NULL first.

There is no point to call slotmem_attach() in this case, the slot is already
initialized because it's either inherited/fork()ed on Unixes, or on Windows
the attachment happened in post_config/slotmem_create() already.

One case where slotmem_attach() would fail is when balancers are defined
globally (main server) and some virtualhosts don't have/use any mod_proxy
configuration/directive. In this case their proxy server config is a pointer
copy of the main server thus their slots are already initialized in both
post_config and child_init hooks. While the case was already handled in
the balancer_post_config(), it did not in balancer_child_init() where we
relied on slotmem_attach() to be a noop.

[Reverted by r1831396]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1831218 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_balancer.c

index 7e03960d1247e9a381f5d8d3694fc1d759f5a514..975811d472eec7d33606637307e64854f2a3a00a 100644 (file)
@@ -1885,7 +1885,7 @@ static void balancer_child_init(apr_pool_t *p, server_rec *s)
         proxy_server_conf *conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module);
         apr_status_t rv;
 
-        if (conf->balancers->nelts) {
+        if (conf->balancers->nelts && !conf->bslot) {
             apr_size_t size;
             unsigned int num;
             storage->attach(&(conf->bslot), conf->id, &size, &num, p);