[mp1] Method handler that eventually seems to "forget" it's a method handler

[prev] [thread] [next] [Date index for 2005/02/02]

From: Andrew Green
Subject: [mp1] Method handler that eventually seems to "forget" it's a method handler
Date: 14:54 on 02 Feb 2005
Hi,

I seem to have a bizarre problem with method handlers on my setup.  I 
have a set of different handlers, all of which are method handlers so 
that I can easily inherit shared code across a collection of different 
installations of my application on the same server.

The first handler to get invoked is a PerlTransHandler -- everything 
works fine (or at least seems to) for quite some time, but then the 
handler begins "forgetting" that it's a method handler, and instead of 
the class being passed before $r, $r becomes the first thing passed.  
At least, that seems to be what's happening.  Is this a known problem?

My setup is as follows:

	 Perl 5.8.0 (Red Hat EL 3 default)
	 Apache/1.3.29
	 mod_perl/1.29


Here's what I imagine to be the relevant bits of httpd.conf:

	MinSpareServers 10
	MaxSpareServers 20
	StartServers 10
	MaxClients 60
	MaxRequestsPerChild 1000
	...
	<VirtualHost xxx>
		PerlTransHandler MyApp::MyInstall::Dispatcher
		...


Here's the relevant bits of Dispatcher.pm:

	package MyApp::MyInstall::Dispatcher;

	use strict;
	use Apache::Constants qw(OK DECLINED NOT_FOUND REDIRECT FORBIDDEN);
	use Apache::URI;

	our @ISA = qw(MyApp::Core::Dispatcher);

	1;

	####

	sub handler ($$) {

		my ($class,$r) = @_;
		return DECLINED unless ($r->is_initial_req());
		...


And here's the error (that only starts appearing after the server's 
been running for a while:

	Can't call method "is_initial_req" on an undefined value...

The error then points to the line quoted above.  Of course, Apache 
never gets to other handlers later in the sequence, so I can't easily 
see whether the problem is limited to TransHandlers, or whether all my 
method handlers would stop acting as such.  Restarting the server makes 
the problem go away -- for a while!

I'd really like to avoid having to upgrade/change Perl or mod_perl if 
at all possible.  Nonetheless, any help, advice or guidance anyone can 
provide would be very much appreciated.

Cheers,
Andrew.

[mp1] Method handler that eventually seems to "forget" it's a method handler
Andrew Green 14:54 on 02 Feb 2005

Generated at 12:39 on 05 Feb 2005 by mariachi v0.52