We've tested in CentOS 5.4 (apache 2.2.3) and CentOS 6.3 (apache 2.2.15)

We are not seeing proxy workers get created when a proxy statement is
created inside a <Virtualhost>. The documentation
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#workers says that a
ProxyPass statement or a <Proxy> block will create a defined worker
associated with the origin.

We have made empirical tests to show the behavior described in the
documentation is not happening. If there is some better way to list out all
active workers and which ProxyPass lines are sharing them (reading in the
"Worker Sharing" note on the above page we would love to know. The simple
test below seems to show worker creation, but we know of no way to see the
exact settings of the worker itself, and no way to see how worker sharing
is actually happening (e.g. which ProxyPass statements are a part of which
worker). The same behavior is exhibited for http workers as well, so it is
not a function of an ajp worker.

Our tests:

Set LogLevel to debug

Test 1:

In httpd.conf (or any file in conf.d) add the lines (outside of any vhost)

<Proxy ajp://localhost:11111>
    ProxySet max=300 smax=40 ttl=10
</Proxy>

Run "apachectl graceful"

You will see in /var/log/httpd/error_log repeated for each httpd child
process

[Tue Sep 18 12:25:57 2012] [debug] proxy_util.c(1854): proxy: grabbed
scoreboard slot 1 in child 6751 for worker ajp://localhost:11111 [Tue Sep
18 12:25:57 2012] [debug] proxy_util.c(1873): proxy: worker
ajp://localhost:11111 already initialized [Tue Sep 18 12:25:57 2012]
[debug] proxy_util.c(1967): proxy: initialized single connection worker 1
in child 6751 for (localhost) [Tue Sep 18 12:25:57 2012] [debug]
proxy_util.c(1854): proxy: grabbed scoreboard slot 2 in child 6751 for
worker proxy:reverse [Tue Sep 18 12:25:57 2012] [debug] proxy_util.c(1967):
proxy: initialized single connection worker 2 in child 6751 for (*)

Test 2

Remove the above entry and in httpd.conf (or any file in conf.d) add the
lines

<Virtualhost *:80>
<Proxy ajp://localhost:11111>
    ProxySet max=300 smax=40 ttl=10
</Proxy>
</VirtualHost>

Run "apachectl graceful"

You will see in /var/log/httpd/error_log repeated for each httpd child
process (no worker for localhost:1111 ever shows in the log)

[Tue Sep 18 12:29:05 2012] [debug] proxy_util.c(1854): proxy: grabbed
scoreboard slot 1 in child 6784 for worker proxy:reverse [Tue Sep 18
12:29:05 2012] [debug] proxy_util.c(1873): proxy: worker proxy:reverse
already initialized [Tue Sep 18 12:29:05 2012] [debug] proxy_util.c(1967):
proxy: initialized single connection worker 1 in child 6784 for (*)

We also saw that any behavior defined for a proxy set inside a virtualhost
only applies to the default "reverse" worker. Even if the defined worker is
used inside and outside the vhost. Parameters set in the vhost go to
default, parameters outside go to the defined worker.

So you have both together like so:

<Proxy ajp://localhost:11111>
    ProxySet max=300 smax=40 ttl=10
</Proxy>
<Virtualhost *:80>
<Proxy ajp://localhost:11111>
    ProxySet max=100 smax=40 ttl=10
</Proxy>
ProxyPass / ajp://localhost:11111/
</VirtualHost>

Then the worker "ajp://localhost:11111" will have max=300 and the worker
"reverse" will have max=100. The ProxySet inside the virtualhost does not
configure the worker defined in its <Proxy>, but configures the default
"reverse" worker instead. The same behavior is observed if you use
ProxyPass instead of <Proxy> and ProxySet.

Since we don't know of a good way to peek inside apache, here is the
summary of inferences and observations.

1) We infer from the fact that the error_log wrote the name of an explicit
worker in test 1 and not in test 2, that test 2 did not in fact make the
worker.
2) We observed in practice (from behavior) that the settings of what we
thought was an defined worker outside the virtual host did not apply to the
same named worker inside the virtual host. Access to "/" took the
configuration settings of the default "reverse" worker, not the explicit
worker.

Questions:

1) Are we missing a setting that will allow a defined worker to be created
and configured within a virtual host?
2) Is the documentation misleading and it is forbidden to have workers
defined in virtual hosts?
3) Is this a bug? If so, is it fixed in some other version?
4) Is there a way to see the settings of a worker?
5) Is there a way to see which ProxyPass lines are getting grouped with
which worker?

Reply via email to