DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26439>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26439

Rewritemap with prg: corrupting rewritten URLs under high load?

           Summary: Rewritemap with prg: corrupting rewritten URLs under
                    high load?
           Product: Apache httpd-2.0
           Version: 2.0.48
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: mod_rewrite
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


I'm using a rewritemap directive on a front-end apache proxy to call a simple 
perl script to load balance across 4 back-end servers in a way similar to that 
suggested in the apache.org rewrite guide.

I've subjected the setup to high load (approx 70 transactions a second) and 
Apache will proxy fine to the back-end servers for a while, then 
intermittently the back-end servers begin returning 404s because the rewritten 
URLs have been corrupted.  Then the URLs come good, then they go bad.  It's 
intermittent and ONLY under high loads (I'm using siege).  It sounds a little 
similar to case 25520, but in my case, the problem is more than just logging 
because the rewrite destinations don't recognize the rewritten corrupted URLs.

I'm using the Worker MPM - I haven't tried anything else.  Í build Apache from 
source on a Redhat 9 SMP machine with all recent updates (including glibc) 
applied.

I include below an example bad rewrite, the relevant rewrite directives and 
the perl script in question.  I'm not an Apache hacker so sorry if this case 
is not technical enough.

httpd.conf
===========

<VirtualHost *:80>
    ProxyVia On
    RewriteEngine On
    RewriteLog    /jrcapps/apache/apache/logs/rewrite.log
    RewriteLogLevel 9
    RewriteMap    lb      prg:/jrcapps/apache/apache/bin/loadbalance.pl
    RewriteRule   /
(.*)   /VirtualHostBase/http/139.191.42.53:80/VirtualHostRoot/$1
    RewriteRule   ^/(.+)$ ${lb:$1}           [P,L]
</VirtualHost>


loadbalance.pl
==============

#!/usr/bin/perl
##
##  loadbalance.pl -- load balancing script
##
 
$| = 1;
 
@names   = (
                "eejnet-zope1:8080",
                "eejnet-zope2:8080",
                "eejnet-zope1:8081",
                "eejnet-zope2:8081"
        );
 
$numserv = scalar(@names);
 
$cnt = 0;
while (<STDIN>) {
    $cnt = (($cnt+1) % $numserv);
    $server = $names[$cnt-1];
    print "http://$server/$_";;
}

##EOF##


rewite.log example 1
====================

127.0.0.1 - - [26/Jan/2004:15:41:52 +0100] [localhost/sid#820a278]
[rid#8243558/initial] (2) init rewrite engine with requested uri /

(ok)

127.0.0.1 - - [26/Jan/2004:15:41:52 +0100] [localhost/sid#820a278]
[rid#8243558/initial] (3) applying pattern '/(.*)' to uri '/'

(ok)

127.0.0.1 - - [26/Jan/2004:15:41:52 +0100] [localhost/sid#820a278]
[rid#8243558/initial] (2) rewrite / -
> /VirtualHostBase/http/139.191.42.53:80/VirtualHostRoot/127.0.0.1 - - 
[26/Jan/2004:15:41:52 +0100] [localhost/sid#820a278][rid#8243558/initial] (3) 
applying pattern '^/(.+)$' to 
uri '/VirtualHostBase/http/139.191.42.53:80/VirtualHostRoot/'

(ok)

127.0.0.1 - - [26/Jan/2004:15:41:52 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (5) map lookup OK: map=lb 
key=VirtualHostBase/http/139.191.42.53:80/VirtualHostRoot/ -> 
val=http://eejnet-zope2:8081/VirtualHostBase/http/139.191.42.53:lotot

(not ok)

127.0.0.1 - - [26/Jan/2004:15:41:52 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (2) 
rewrite /VirtualHostBase/http/139.191.42.53:80/VirtualHostRoot/ -> 
http://eejnet-zope2:8081/VirtualHostBase/http/139.191.42.53:lotot

(not ok)

127.0.0.1 - - [26/Jan/2004:15:41:52 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (2) forcing proxy-throughput with http://eejnet-
zope2:8081/VirtualHostBase/http/139.191.42.53:lotot

(not ok)

127.0.0.1 - - [26/Jan/2004:15:41:52 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (1) go-ahead with proxy request proxy:http://eejnet-
zope2:8081/VirtualHostBase/http/139.191.42.53:lotot [OK]


rewite.log example 2
====================

127.0.0.1 - - [26/Jan/2004:15:41:51 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (2) init rewrite engine with requested uri /

(ok)

127.0.0.1 - - [26/Jan/2004:15:41:51 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (3) applying pattern '/(.*)' to uri '/'

(ok)

127.0.0.1 - - [26/Jan/2004:15:41:51 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (2) rewrite / -
> /VirtualHostBase/http/139.191.42.53:80/VirtualHostRoot/127.0.0.1 - - 
[26/Jan/2004:15:41:51 +0100] [localhost/sid#820a278][rid#82695f0/initial] (3) 
applying pattern '^/(.+)$' to 
uri '/VirtualHostBase/http/139.191.42.53:80/VirtualHostRoot/'

(ok)

127.0.0.1 - - [26/Jan/2004:15:41:51 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (5) map lookup OK: map=lb 
key=VirtualHostBase/http/139.191.42.53:80/VirtualHostRoot/ -> 
val=http://eejnet-zope1:8081/VirtualHostBase/http/139.191.42rulotot

(not ok)

127.0.0.1 - - [26/Jan/2004:15:41:51 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (2) 
rewrite /VirtualHostBase/http/139.191.42.53:80/VirtualHostRoot/ -> 
http://eejnet-zope1:8081/VirtualHostBase/http/139.191.42rulotot

(not ok)

127.0.0.1 - - [26/Jan/2004:15:41:51 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (2) forcing proxy-throughput with http://eejnet-
zope1:8081/VirtualHostBase/http/139.191.42rulotot

(not ok)

127.0.0.1 - - [26/Jan/2004:15:41:51 +0100] [localhost/sid#820a278]
[rid#82695f0/initial] (1) go-ahead with proxy request proxy:http://eejnet-
zope1:8081/VirtualHostBase/http/139.191.42rulotot [OK]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to