You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Doug MacEachern <do...@covalent.net> on 2000/09/28 17:17:12 UTC
Re: recursion in Apache::Constants::AUTOLOAD?
On Mon, 26 Jun 2000, Jim Winstead wrote:
> We were seeing some servers spin out of control (allocating memory
> slowly) in Apace::Constants::AUTOLOAD (which apparently has been
> reported in the mailing list before).
>
> The attached patch fixes the problems for us. Could someone who
> understands what is going on here shed some light?
i still don't understand how __AUTOLOAD can be undefined inside the
server. this patch adds an extra check that will prevent recursion if
__AUTOLOAD is somehow undefined and print a stacktrace to give some idea
where the problem is.
Index: Constants/Constants.pm
===================================================================
RCS file: /home/cvs/modperl/Constants/Constants.pm,v
retrieving revision 1.20
diff -u -r1.20 Constants.pm
--- Constants/Constants.pm 2000/03/03 20:42:01 1.20
+++ Constants/Constants.pm 2000/09/28 15:12:36
@@ -17,9 +17,16 @@
if ($ENV{MOD_PERL}) {
#outside of mod_perl this will recurse looking for __AUTOLOAD, grr
*AUTOLOAD = sub {
- #why must we stringify first???
- __AUTOLOAD() if "$Apache::Constants::AUTOLOAD";
- goto &$Apache::Constants::AUTOLOAD;
+ if (defined &__AUTOLOAD) { #make extra sure we don't recurse
+ #why must we stringify first???
+ __AUTOLOAD() if "$Apache::Constants::AUTOLOAD";
+ goto &$Apache::Constants::AUTOLOAD;
+ }
+ else {
+ require Carp;
+ Carp::confess("__AUTOLOAD is undefined, ",
+ "trying to AUTOLOAD $Apache::Constants::AUTOLOAD");
+ }
};
}
Re: recursion in Apache::Constants::AUTOLOAD?
Posted by David Alan Pisoni <da...@cnation.com>.
Sorry I don't have much in the way of details, but we had this problem several months ago (probably in a previous version of mod_perl), but it silently went away.
(I'm reminded of it because recently I was reviewing the handler() of our recently open-sourced embedded parser, Apache::XPP, and found that the constants had been hard-coded to avoid the AUTOLOAD() spinning. I put the constant calls back in :-)
Enjoy,
David
At 8.17 -0700 9/28/2000, Doug MacEachern wrote:
>On Mon, 26 Jun 2000, Jim Winstead wrote:
>
>> We were seeing some servers spin out of control (allocating memory
>> slowly) in Apace::Constants::AUTOLOAD (which apparently has been
>> reported in the mailing list before).
>>
>> The attached patch fixes the problems for us. Could someone who
>> understands what is going on here shed some light?
>
>i still don't understand how __AUTOLOAD can be undefined inside the
>server. this patch adds an extra check that will prevent recursion if
>__AUTOLOAD is somehow undefined and print a stacktrace to give some idea
>where the problem is.
>
>Index: Constants/Constants.pm
>===================================================================
>RCS file: /home/cvs/modperl/Constants/Constants.pm,v
>retrieving revision 1.20
>diff -u -r1.20 Constants.pm
>--- Constants/Constants.pm 2000/03/03 20:42:01 1.20
>+++ Constants/Constants.pm 2000/09/28 15:12:36
>@@ -17,9 +17,16 @@
> if ($ENV{MOD_PERL}) {
> #outside of mod_perl this will recurse looking for __AUTOLOAD, grr
> *AUTOLOAD = sub {
>- #why must we stringify first???
>- __AUTOLOAD() if "$Apache::Constants::AUTOLOAD";
>- goto &$Apache::Constants::AUTOLOAD;
>+ if (defined &__AUTOLOAD) { #make extra sure we don't recurse
>+ #why must we stringify first???
>+ __AUTOLOAD() if "$Apache::Constants::AUTOLOAD";
>+ goto &$Apache::Constants::AUTOLOAD;
>+ }
>+ else {
>+ require Carp;
>+ Carp::confess("__AUTOLOAD is undefined, ",
>+ "trying to AUTOLOAD $Apache::Constants::AUTOLOAD");
>+ }
> };
> }
>