You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2003/11/21 02:12:31 UTC
mod_include's recursion detection
In one of the tests I've a dynamic response handler whose output is going
through INCLUDES, which triggers a sub-request to the same dynamic response
handler with different ? arguments or path_info, which repeat it once more.
1) a dynamic response handler /foo sends (/one is path_info):
"one <!--#include virtual="/foo/one" -->"
2) INCLUDES calls a subrequest on /foo/one which generates
"two <!--#include virtual="/foo/two" -->"
3) which again reaches INCLUDES and again generating a sub-request,
this time on /foo/two
but INCLUDES detects a recursion:
[Thu Nov 20 16:59:31 2003] [error] [client 127.0.0.1] unable to include
"/foo/two" in parsed file /home/stas/apache.org/mp-inc-mp/t/htdocs/foo
First of all, there is no /home/stas/apache.org/mp-inc-mp/t/htdocs/foo, it's a
virtual dynamic handler and the error is wrong. I don't think mod_include
should do the detection at all if the file doesn't exist, because dynamic
handler != static file.
Even in the case of static SSI file, I can see where a call to the same file
may generate different outputs, and is a wanted behavior and not a recursion.
It's good to detect recursions when they loop through 100 or so
self-invocations, but for one call?
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: mod_include's recursion detection
Posted by Stas Bekman <st...@stason.org>.
André Malo wrote:
> * Stas Bekman <st...@stason.org> wrote:
>
>
>>>> but INCLUDES detects a recursion:
>>>>
>>>
>>>There is a config setting which can increase the number of redirects
>>>allowed. as far as dynamic vs static.. mod-include doesn't know what is
>>>underneath it. I belive the recursion is set by default at 10/20.
>
>
> No. mod_include has its own recursion detector. But after introducing the
> global recursion stopper I think, we can safely remove it and trust in the
> core mechanism.
So will it allow me to do:
1) a dynamic response handler /foo sends (/one is path_info):
"one <!--#include virtual="/foo/one" -->"
2) INCLUDES calls a subrequest on /foo/one which generates
"two <!--#include virtual="/foo/two" -->"
3) which again reaches INCLUDES and again generating a sub-request,
this time on /foo/two
here a dynamic resource is called recursively, but it generates a different
output on each call, so it's not really a recursion mod_include is trying to
avoid.
Looks like we again tripping the issue with r->filename, which in this case
should be NULL or whatever, and mod_include knowing that r->filename is not
set is ought to let the dynamic resource decide what's best for it.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: mod_include's recursion detection
Posted by André Malo <nd...@apache.org>.
* Stas Bekman <st...@stason.org> wrote:
> >> but INCLUDES detects a recursion:
> >>
> >
> > There is a config setting which can increase the number of redirects
> > allowed. as far as dynamic vs static.. mod-include doesn't know what is
> > underneath it. I belive the recursion is set by default at 10/20.
No. mod_include has its own recursion detector. But after introducing the
global recursion stopper I think, we can safely remove it and trust in the
core mechanism.
nd
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: mod_include's recursion detection
Posted by Stas Bekman <st...@stason.org>.
[hmm, I've sent here by mistake, planned to fire it to httpd, but since Ian
has kindly replied let's resolve it here already. I've CC'ed Andre as well]
Ian Holsman wrote:
> Stas Bekman wrote:
>
>> In one of the tests I've a dynamic response handler whose output is
>> going through INCLUDES, which triggers a sub-request to the same
>> dynamic response handler with different ? arguments or path_info,
>> which repeat it once more.
>>
>> 1) a dynamic response handler /foo sends (/one is path_info):
>>
>> "one <!--#include virtual="/foo/one" -->"
>>
>> 2) INCLUDES calls a subrequest on /foo/one which generates
>>
>> "two <!--#include virtual="/foo/two" -->"
>>
>> 3) which again reaches INCLUDES and again generating a sub-request,
>> this time on /foo/two
>>
>> but INCLUDES detects a recursion:
>>
>
> There is a config setting which can increase the number of redirects
> allowed. as far as dynamic vs static.. mod-include doesn't know what is
> underneath it. I belive the recursion is set by default at 10/20.
> FWIW.. m-perl calling a m-perl subrequest via mod-include is just asking
> for a segfault.
What do you mean asking for a segfault? Is it non-reentrant? Why would a
sub-request and its filter chain intervent with the main request and its filters?
This is exactly what I'm trying to reproduce after receiving this segfault report:
http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=106894902423356&w=2
notice that it happens in the httpd land.
> and dynamic handlers can get into infite loops much easier than static
> files and will result in the entire server crashing.
Why?
>> [Thu Nov 20 16:59:31 2003] [error] [client 127.0.0.1] unable to
>> include "/foo/two" in parsed file
>> /home/stas/apache.org/mp-inc-mp/t/htdocs/foo
>>
>> First of all, there is no
>> /home/stas/apache.org/mp-inc-mp/t/htdocs/foo, it's a virtual dynamic
>> handler and the error is wrong. I don't think mod_include should do
>> the detection at all if the file doesn't exist, because dynamic
>> handler != static file.
>>
>> Even in the case of static SSI file, I can see where a call to the
>> same file may generate different outputs, and is a wanted behavior and
>> not a recursion.
>>
>> It's good to detect recursions when they loop through 100 or so
>> self-invocations, but for one call?
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: mod_include's recursion detection
Posted by Ian Holsman <li...@holsman.net>.
Stas Bekman wrote:
> In one of the tests I've a dynamic response handler whose output is
> going through INCLUDES, which triggers a sub-request to the same dynamic
> response handler with different ? arguments or path_info, which repeat
> it once more.
>
> 1) a dynamic response handler /foo sends (/one is path_info):
>
> "one <!--#include virtual="/foo/one" -->"
>
> 2) INCLUDES calls a subrequest on /foo/one which generates
>
> "two <!--#include virtual="/foo/two" -->"
>
> 3) which again reaches INCLUDES and again generating a sub-request,
> this time on /foo/two
>
> but INCLUDES detects a recursion:
>
There is a config setting which can increase the number of redirects
allowed. as far as dynamic vs static.. mod-include doesn't know what is
underneath it. I belive the recursion is set by default at 10/20.
FWIW.. m-perl calling a m-perl subrequest via mod-include is just asking
for a segfault.
and dynamic handlers can get into infite loops much easier than static
files and will result in the entire server crashing.
> [Thu Nov 20 16:59:31 2003] [error] [client 127.0.0.1] unable to include
> "/foo/two" in parsed file /home/stas/apache.org/mp-inc-mp/t/htdocs/foo
>
> First of all, there is no /home/stas/apache.org/mp-inc-mp/t/htdocs/foo,
> it's a virtual dynamic handler and the error is wrong. I don't think
> mod_include should do the detection at all if the file doesn't exist,
> because dynamic handler != static file.
>
> Even in the case of static SSI file, I can see where a call to the same
> file may generate different outputs, and is a wanted behavior and not a
> recursion.
>
> It's good to detect recursions when they loop through 100 or so
> self-invocations, but for one call?
>
> __________________________________________________________________
> Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org http://ticketmaster.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org