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");
+ }
};
}