cfreak has asked for the wisdom of the Perl Monks concerning the following question:
I have a large mod_perl program that uses Apache::Request. My site is getting ready to go live and as more and more people are in it, testing, adding data, etc. I've started seeing instances where something is clicked and nothing happens (Firefox is the browser). Other people are reporting this behavior as well.
After testing for two days I finally discovered that this seems to appear when I make a call to $apr->param('someparam');. Warnings just before the call appear in the log correctly but on some requests it does not continue past this point. Instead of getting an error in the logs or to the browser, its as though nothing happened.
My code is too long to post all of it here but here's the basic setup:
# main handler use strict; # this is a sub-class of my module WSC::Common which puts a # database handle and the request object in a common object # (as well as sets up all the other functions etc.) use SWMetal::Init (); # Configuration for this site use SWMetal::Conf (); # all the other needed modules are in the startup.pl sub handler { my $r = shift; my $apr = Apache::Request->new($r); my $conf = SWMetal::Conf->new(); my $common = SWMetal::Init->new($apr,$conf,{admin=>1}); my %admin_scripts = ( # Here theres a hash with referenced functions # that can get called. ); # I call them 'scripts' because to make URLs shorter # I used the path_info function my $script = $apr->path_info(); # some regex stuff here to strip any slashes or other # unwanted stuff from $script if(exists $admin_scripts{$script}) { return $admin_scripts{ $script }->($common); } else { return $admin_scripts{default}->($common); } } # all that works fine .. then in the called function sub foo { my $common = shift; # usually there is some kind of request. my $apr = $common->apr; # common has an AUTOLOAD sub that returns +the key of the hash based on the function name. # Then the problem occurs here, with the first call to param(): my $request = $apr->param('request'); # .... more stuff }
Oh and basically all SWMetal::Init does is, use WSC::Common as its base and define some functions. Common uses several modules as its base and connects to the database. Then it returns a blessed reference that contains the database handle, the conf and the apr passed to it. Calls to SWMetal::Init->new() return $self->SUPER::new().
The problem doesn't happen everytime, if it happens, often clicking the link or button again will get it to go on through. I'm completely stumped.... anyone seen behavior like this before?
UPDATE I found in the main error log that the children of these requests are actually segfaulting :(. I have a backtrace, looks like the segfault occurs in the request table ... not really sure how to fix the problem, hopefully someone on the mod_perl list can help me ...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Calls to Apache::Request's param method sometimes end the program and return no data
by perrin (Chancellor) on Dec 02, 2004 at 18:44 UTC | |
by cfreak (Chaplain) on Dec 02, 2004 at 19:42 UTC | |
by perrin (Chancellor) on Dec 02, 2004 at 19:49 UTC |