You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by MJH <mj...@liminalflux.net> on 2004/04/13 23:53:49 UTC
[mp2?] silent exit on undefined subroutine
Whilst trying to debug a script running under mp2/Apache::Registry I was
getting failures where the script would just exit in the middle with no
warnings, error messages or other indication to say what might have happened.
I narrowed it down to a call to a subroutine that wasn't in local scope (I'd
forgotten to do a "use mylocalfunctions::debug" to include my debugging
routines into one of my local modules).
Further testing reduced the cause to a "bless" call for the session management
object I'm using (not anything from cpan). If I try calling an undefined
subroutine before the bless (which at that point is on an empty hash
reference), I get the error message. If I call it after the bless, I get no
error and an immediate exit. I've attempted to reproduce this using just perl
and always gett the error message.
Has anyone seen anything like this before (google, perldoc, etc haven't turned
up anything)? Other than stripping everything down to make a minimalist test
case (which is what I'm working on at the moment), is there anything else I
can do to try and track what's happening?
2. Used Components and their Configuration:
*** mod_perl version 1.9911
***
using /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi/Apache2/Apache/BuildConfig.pm
*** Makefile.PL options:
MP_APR_CONFIG => /usr/bin/apr-config
MP_APXS => /usr/sbin/apxs2
MP_AP_PREFIX => /usr
MP_COMPAT_1X => 1
MP_DEBUG => 1
MP_GENERATE_XS => 1
MP_INST_APACHE2 => 1
MP_LIBNAME => mod_perl
MP_TRACE => 1
MP_USE_DSO => 1
*** /usr/sbin/httpd2 -V
Server version: Apache-AdvancedExtranetServer/2.0.48
Server built: Mar 16 2004 15:30:28
Server's Module Magic Number: 20020903:4
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_PROC_PTHREAD_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT="/etc/httpd/2.0"
-D SUEXEC_BIN="/usr/sbin/apache2-suexec"
-D DEFAULT_PIDLOG="/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="/var/run/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd2.conf"
*** /usr/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
Platform:
osname=linux, osvers=2.6.0-1mdkenterprise,
archname=i386-linux-thread-multi
uname='linux no.mandrakesoft.com 2.6.0-1mdkenterprise #1 smp thu dec 18
16:11:28 est 2003 i686 unknown unknown gnulinux '
config_args='-des -Dinc_version_list=5.8.2/i386-linux-thread-multi 5.8.2
5.8.1/i386-linux-thread-multi 5.8.1 5.8.0/i386-linux-thread-multi 5.8.0 5.6.1
5.6.0 -Darchname=i386-linux -Dcc=gcc -Doptimize=-O2 -fomit-frame-pointer
-pipe -march=i586 -mcpu=pentiumpro -Dprefix=/usr -Dvendorprefix=/usr
-Dsiteprefix=/usr -Dman3ext=3pm -Dcf_by=MandrakeSoft -Dmyhostname=localhost
-Dperladmin=root@localhost -Dd_dosuid -Ud_csh -Duseshrplib -Dusethreads'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro ',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='3.3.2 (Mandrake Linux 10.0 3.3.2-4mdk)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.3.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.3'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic
-Wl,-rpath,/usr/lib/perl5/5.8.3/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Feb 3 2004 13:50:20
%ENV:
PERL_LWP_USE_HTTP_10="1"
@INC:
/usr/lib/perl5/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/5.8.3
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.3
/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.1
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.3
/usr/lib/perl5/vendor_perl/5.8.2
/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.1
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
.
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2?] silent exit on undefined subroutine
Posted by Frank Wiles <fr...@wiles.org>.
On Tue, 13 Apr 2004 17:53:49 -0400
MJH <mj...@liminalflux.net> wrote:
>
> Whilst trying to debug a script running under mp2/Apache::Registry I
> was getting failures where the script would just exit in the middle
> with no warnings, error messages or other indication to say what might
> have happened.
>
> I narrowed it down to a call to a subroutine that wasn't in local
> scope (I'd forgotten to do a "use mylocalfunctions::debug" to include
> my debugging routines into one of my local modules).
>
> Further testing reduced the cause to a "bless" call for the session
> management object I'm using (not anything from cpan). If I try calling
> an undefined subroutine before the bless (which at that point is on an
> empty hash reference), I get the error message. If I call it after the
> bless, I get no error and an immediate exit. I've attempted to
> reproduce this using just perl and always gett the error message.
>
> Has anyone seen anything like this before (google, perldoc, etc
> haven't turned up anything)? Other than stripping everything down to
> make a minimalist test case (which is what I'm working on at the
> moment), is there anything else I can do to try and track what's
> happening?
Apache::DB has been ported to mp2 so if you want you can use the
Perl debugger to step through your code line by line, by break point,
etc. and see exactly what is happening.
I'll be releasing the new code on CPAN sometime tomorrow, but you can
grab a prelim copy at:
http://cpan.org/authors/id/F/FW/FWILES/Apache-DB-0.07.tar.gz
I'm not 100% sure this will help you find the problem, but it's worth
a shot.
---------------------------------
Frank Wiles <fr...@wiles.org>
http://frank.wiles.org
---------------------------------
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2?] silent exit on undefined subroutine
Posted by Stas Bekman <st...@stason.org>.
MJH wrote:
> On Tuesday 13 April 2004 8:22 pm, Stas Bekman wrote:
>
>
>>>Anything else I can try?
>>
>>Second, please package this bug reproducing code into the bug reporting
>>skeleton, linked from:
>>http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description
>>test that you have the problem with and post it here.
>
>
> I spent the morning trying to get it to work under the skeleton and failed.
> I'm not sure what's different about Apache::Test than the actual server.
> However, in trying to work that out (by incrementally stripping the actual
> server's config down to nothing), I did discover that removing "use
> Devel::Profiler::Apache" from my startup script made the problem vanish.
> Including it under the test skeleton, (along with the entirety of the rest of
> my config except the mod_ssl section, which I couldn't get to work) does not
> reproduce the problem however).
>
> I haven't found anything specific about that module that might cause this
> symptom, but at least it's localised. I'll investigate further when I get
> chance.
At least you've found the cause of the problem, while minimizing your config,
which as you can see we would have never discovered, just based on your test
code. We always need both.
--
__________________________________________________________________
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2?] silent exit on undefined subroutine
Posted by MJH <mj...@liminalflux.net>.
On Tuesday 13 April 2004 8:22 pm, Stas Bekman wrote:
> > Anything else I can try?
> Second, please package this bug reproducing code into the bug reporting
> skeleton, linked from:
> http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description
> test that you have the problem with and post it here.
I spent the morning trying to get it to work under the skeleton and failed.
I'm not sure what's different about Apache::Test than the actual server.
However, in trying to work that out (by incrementally stripping the actual
server's config down to nothing), I did discover that removing "use
Devel::Profiler::Apache" from my startup script made the problem vanish.
Including it under the test skeleton, (along with the entirety of the rest of
my config except the mod_ssl section, which I couldn't get to work) does not
reproduce the problem however).
I haven't found anything specific about that module that might cause this
symptom, but at least it's localised. I'll investigate further when I get
chance.
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2?] silent exit on undefined subroutine
Posted by MJH <mj...@liminalflux.net>.
On Tuesday 13 April 2004 8:22 pm, Stas Bekman wrote:
> Are you sure you pasted the code that you were testing?
Oops, sorry. No, I trimmed it a little and forgot to sync everything (I was
editing the email and testing as I narrowed down the problem).
> First, please submit a proper bug report:
> http://perl.apache.org/bugs/
> Second, please package this bug reproducing code into the bug reporting
> skeleton, linked from:
> http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description
> test that you have the problem with and post it here.
Will do that in the morning, now that I know this isn't some simple "problem
exists between chair and keyboard" situation.
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2?] silent exit on undefined subroutine
Posted by Stas Bekman <st...@stason.org>.
MJH wrote:
> On Tuesday 13 April 2004 5:53 pm, MJH wrote:
>
>
>>turned up anything)? Other than stripping everything down to make a
>>minimalist test case (which is what I'm working on at the moment), is there
>>anything else I can do to try and track what's happening?
>
>
> The results of which give me the following test case (which fails under
> mod_perl but not perl):
>
> test.pl:
> #!/usr/bin/perl
>
> use strict;
> use test;
> my $session = new tmaxx::test;
^^^^^^^^^^^^
Are you sure you pasted the code that you were testing?
> test.pm:
> #!/usr/bin/perl
>
> package test;
^^^^^^^^^^^^^
> Anything else I can try?
First, please submit a proper bug report:
http://perl.apache.org/bugs/
Second, please package this bug reproducing code into the bug reporting
skeleton, linked from:
http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description
test that you have the problem with and post it here.
Thanks.
__________________________________________________________________
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2?] silent exit on undefined subroutine
Posted by MJH <mj...@liminalflux.net>.
On Tuesday 13 April 2004 5:53 pm, MJH wrote:
> turned up anything)? Other than stripping everything down to make a
> minimalist test case (which is what I'm working on at the moment), is there
> anything else I can do to try and track what's happening?
The results of which give me the following test case (which fails under
mod_perl but not perl):
test.pl:
#!/usr/bin/perl
use strict;
use test;
my $session = new tmaxx::test;
warn "complete";
test.pm:
#!/usr/bin/perl
package test;
use strict;
sub new
{
my $class = shift; # class is always the first parameter
my $this = {};
bless $this;
undefinedfunction();
return $this;
}
sub DESTROY
{
my $r = Apache->request;
$r->rflush();
}
1;
If you move "undefinedfunction();" up one line (to above the bless), then you
get the error "ModPerl::Registry: Undefined subroutine
&test::undefinedfunction..." otherwise you just get silence (the warn
"complete" is never called).
If you remove the call to $r->rflush() then you also get the error (despite
the fact that the DESTROY method is not called by that point.
So it looks like some sort of compile time error.
Anything else I can try?
(The rflush is there because the app I'm working on tracks
per-user/per-session bandwidth and the cleanup phase writes this to a
database. To get the correct stats the data needs to have actually been sent.
This is probably irrelevant).
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html