You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1997/07/11 09:15:54 UTC

Re: mod_include/841: mod_rewrite keeps looping although the client closed the connection (fwd)

Hello Marc Slemko, in a previous mail you wrote:

> >Number:         841
> >Category:       mod_include
> >Synopsis:       mod_rewrite keeps looping although the client closed the connection
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       medium
> >Responsible:    apache (Apache HTTP Project)
> >State:          open
> >Class:          sw-bug
> >Submitter-Id:   apache
> >Arrival-Date:   Tue Jul  8 08:10:02 1997
> >Originator:     sfx@unix-ag.org
> >Organization:
> apache
> >Release:        1.2.1
> >Environment:
> Linux 2.0 i586
> (Apache 1.2.1-dev with mod_rewrite 3.0.7)
> >Description:
> ook at the following config (tested in a .htaccess file)
> 
>   RewriteEngine On
>   RewriteRule test\.html test.html
> 
> Well, yes it makes no sense, but I you access that test.html page
> mod_rewrite starts to do weird things.
> No output is send to the (waiting) client, no entries appear in the
> rewrite.log (with level 10) and no entries appear in the error.log.
> The httpd-child that accepted the request to the test.html page
> immediately starts to consume memory and all available cpu-cycles.
> After some minutes the process sucked nearly all available memory/swap
> of the host.
> 
> The biggest problem is the fact that the child-process is not killed
> when the client closed the connection... the process still continues
> to eat all memory and cpu-cycles.

The problem here is that this occurs in the .htaccess file where the rewrite
engine needs to force an internal redirect to bring the new URL into play
because the API does not provide URL rewriting at the .htaccess level (which
itself is implemented via the API fixup hook). So, the URL enters again the
Apache and next time the ruleset matches again. And again and again. Not
really a bug in the rewriting engine, just a problem with the way it has to
workaround the API restrictions.

I've added a check to mod_rewrite 3.0.9 now which prevents the internal
redirect if the last URL is the same as the new URL. THis fixes the problem.
You can close the PR. 

Thanks for the hint.

Greetings,
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com