Bug 56008 - IfDefine not evaluated correctly after some reloads
Summary: IfDefine not evaluated correctly after some reloads
Status: RESOLVED DUPLICATE of bug 57328
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.4.6
Hardware: PC Linux
: P2 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-14 21:49 UTC by Stefan Greiner
Modified: 2014-12-08 14:39 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Greiner 2014-01-14 21:49:33 UTC
We used the Apache 2.4.2 and since availablity 2.4.6 in our global Apache Setup.
It occured three times now (at different config sections) that the check with IfDefine was not evaluated correctly which resulted in big errors.

Here is a simple example to show how drastic the implications can be: Let us assume we have an apache httpd 2.4.6 in the USA and one in the UK.
The daemons are started with the -D flag as follows:
USA: -DUSA
UK: -DUK

Both have this config:

__________________________

Define ip_of_USA_location 10.30.0.2
Define ip_of_UK_location 10.40.0.2
<VirtualHost ${ip_of_XXX_location}:80>
# some configs
# ...
RewriteEngine On

<IfDefine USA>
RewriteRule ^/(.*)$ http://${ip_of_UK_location}/getSomeStuffOnlyAvailableInUk/$1 [P]
</IfDefine>
<IfDefine UK>
RewriteRule ^/(.*)$ http://${ip_of_USA_location}/getSomeStuffOnlyAvailableInUsa/$1 [P]
</IfDefine>

# some configs
# ...
</VirtualHost>

___________________________

Now after several days/reloads/MaxConnectionsPerChild the UK-httpd "thinks" that USA is defined.
That will result in a loop because UK-httpd enters the vhost with UK-IP and proxies to the vhost with UK-IP and so on and endless on.

An other example would be some BalancerMembers only available in that zone. If both are defined the following would produce serious trouble:
<IfDefine USA>
BalancerMember http://10.30.0.70 ...
BalancerMember http://10.30.0.71 ...
</IfDefine>
<IfDefine UK>
BalancerMember http://10.40.0.70 ...
BalancerMember http://10.40.0.71 ...
</IfDefine>

I perhaps should also mention that we use mpm_event.
When the daemon is startet or restartet there works everything as expected. In most of the time when the daemon is reloaded/forks new childs there is also no problem.
We hit that bug now three times in a year and because of my configuration the only thing possible is that the IfDefine sections are not working properly.
I know it is really hard to reproduce, because it works thousend times but in one not, but the problem is there. Heisenbug? :P
Comment 1 Armin Abfalterer 2014-12-08 11:38:51 UTC
Hi Stefan,

I had the same problem and I've found out that there is a bug in the apache core

See my report at https://issues.apache.org/bugzilla/show_bug.cgi?id=57328

I hope the patch will be incorporated asap...

Regards, Armin
Comment 2 Yann Ylavic 2014-12-08 14:39:06 UTC
A fix was commited in trunk (r1643825) for Bug 57328.
Marking this report as duplicated, please re-open if r1643825 does not fix this 
issue.

*** This bug has been marked as a duplicate of bug 57328 ***