modcluster/mod_cluster — pull request #119 by Karm (2014-10-10 09:39:06+00:00)
Title: MODCLUSTER-430, Re-creating proxy_module configuration structures in ord...

...er to have them unique, not being shared with the main_server. Furthermore, some minor httpd 2.2.x compatibility fix and additional logging.

Guys, the problem is a complex one (at least to me :-)), so I would suggest having a discussion on JIRA [MODCLUSTER-430](https://issues.jboss.org/browse/MODCLUSTER-430).

TL;DR
---------
It's _fixed_, CreateBalancers 2 really creates balancer only for the main_server now. The default changed from CreateBalancers 2 to CreateBalancers 0;

Lengthy version
--------------------

After modules and servers are loaded, proxy_module config for VirtualHosts is the same pointer as the main_server one's if and only if there was no mod_proxy related configuration present in that VirtualHost. It's most likely due to the httpd trying save some memory. This breaks our logic based on the fact that one actually can distinguish between these configurations and even configure them separately.

So I did basically two things:

1. If the VirtualHost server's mod_proxy configuration points to the same location in memory as the main_server ones, I allocate a separate space for it. It's done once on startup, so there is no chance of having any performance/memory consumption impact in runtime. Correct me / throw rocks if I'm wrong.

2. I deliberately changed the former default of the CreateBalancers directive from _2 - Create balancers/workers only in the main_server_ to _0 - Create balancers/workers in all VirtualHosts and in the main_server_.

The justification is that this bug/weird behaviour has been around for a long time and I'm sure many instances out there rely on the fact that mod_cluster actually balances all their VirtualHosts by default, so with this bug actually fixed, i.e. having balancer created only for the main server, it would break all these setups.

I tested the behaviour with Apache HTTP Server 2.4.10 and 2.2.26 and it works properly for all three CreateBalancers options. I haven't done any thorough regression testing though...