You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Adam Worrall <ad...@worrall.cc> on 2004/07/17 17:20:40 UTC
[mp2] segfault when using IO::Socket::INET from within
mod_perl1.9915
I'd be grateful for any ideas on where to push this next. I have a
dodgy workaround, but it doesn't make me all that comfortable !
-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:
Using IO::Socket::INET->new() causes a SIGSEGV
The test code is pretty simple ...
my $sock = IO::Socket::INET->new ({'Proto' => 'tcp',
'PeerAddr' => 'localhost',
'PeerPort' => 80});
The problem seems to be down in libnss. It seems to get confused
just after opening (the non-existent) /var/db/protocols.db, and
then SISGEGVs. The same libnss works fine outside of mod_perl,
via the same Perl & IO::Socket::INET; I guess there might be some
interaction between mod_perl/Apache and libnss.
libnss is part of libc, which for me is version 2.2.3 (slackware 9.1).
The symptom vanishes by configuring /etc/nsswitch.conf to only
use files for protocols (just delete the 'db' bit :), but I'm
worried that the problem is still lying around, and could surface
as some other random SIGSEGV.
I've used the bug template, and have a dist available at:
<http://worrall.cc/bug-reporting-skeleton-mp2.tar.gz>
2. Used Components and their Configuration:
*** mod_perl version 1.9915
*** using /opt/local/apps/apache/new/src/mod_perl-2.0/lib/Apache/BuildConfig.pm
*** Makefile.PL options:
MP_APR_LIB => aprext
MP_AP_PREFIX => /apps/apache/new
MP_COMPAT_1X => 1
MP_DEBUG => 1
MP_GENERATE_XS => 1
MP_LIBNAME => mod_perl
MP_TRACE => 1
MP_USE_DSO => 1
MP_USE_STATIC => 1
*** /apps/apache/new/bin/httpd -V
Server version: Apache/2.0.50
Server built: Jul 17 2004 14:17:40
Server's Module Magic Number: 20020903:8
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_SYSVSEM_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="/apps/apache/new"
-D SUEXEC_BIN="/apps/apache/new/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
*** (apr|apu)-config linking info
-L/apps/apache/new/lib -lapr-0 -lrt -lm -lcrypt -lnsl -lpthread -ldl
-L/apps/apache/new/lib -laprutil-0 -lgdbm -ldb-4.2 -lexpat
*** /apps/apache/common/local2/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
Platform:
osname=linux, osvers=2.4.5, archname=i686-linux-thread-multi
uname='linux deacon 2.4.5 #6 fri jun 22 01:38:20 pdt 2001 i686 unknown '
config_args='-des -Dprefix=/apps/apache/common/local2 -Dusethreads -Doptimize=-g'
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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-g',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.3 20010315 (release)', 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='cc', 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.2.3.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.2.3'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Jul 17 2004 14:24:17
%ENV:
PERL_LWP_USE_HTTP_10="1"
@INC:
/apps/apache/common/local2/lib/perl5/5.8.4/i686-linux-thread-multi
/apps/apache/common/local2/lib/perl5/5.8.4
/apps/apache/common/local2/lib/perl5/site_perl/5.8.4/i686-linux-thread-multi
/apps/apache/common/local2/lib/perl5/site_perl/5.8.4
/apps/apache/common/local2/lib/perl5/site_perl
.
*** Packages of interest status:
Apache::Request: -
CGI : 3.04
LWP : 5.79
mod_perl : 1.9915
3. This is the core dump trace: (if you get a core dump):
#0 0x0 in __strtol_internal (nptr=0x405e4072 "/var/db/protocols.db", endptr=0x1, base=16, group=0) at eval.c:35
#1 0x405e3e1e in db_open () from /lib/libnss_db.so.2
#2 0x405e3ed0 in internal_setent () from /lib/libnss_db.so.2
#3 0x405e290e in _nss_db_endprotoent () from /lib/libnss_db.so.2
#4 0x405e2b78 in _nss_db_getprotobyname_r () from /lib/libnss_db.so.2
#5 0x4029547f in __getprotobyname_r (name=0x8322f98 "tcp", resbuf=0x81c7e64,
buffer=0x81cb2e8 "È<,@È<,@", 'ÿ' <repeats 192 times>..., buflen=4096, result=0x81c7e78)
at ../nss/getXXbyYY_r.c:200
#6 0x4043275d in Perl_pp_gprotoent (my_perl=0x81a3278) at pp_sys.c:4888
#7 0x4043266a in Perl_pp_gpbyname (my_perl=0x81a3278) at pp_sys.c:4855
#8 0x403b1841 in Perl_runops_debug (my_perl=0x81a3278) at dump.c:1442
#9 0x40354a53 in S_call_body (my_perl=0x81a3278, myop=0xbffff268, is_eval=0) at perl.c:2285
#10 0x40354543 in Perl_call_sv (my_perl=0x81a3278, sv=0x822f5c0, flags=4) at perl.c:2203
#11 0x40331373 in modperl_callback (my_perl=0x81a3278, handler=0x8241830, p=0x82397f0, r=0x8239828,
s=0x80a1110, args=0x8195648) at modperl_callback.c:99
#12 0x40331dcd in modperl_callback_run_handlers (idx=6, type=4, r=0x8239828, c=0x0, s=0x80a1110, pconf=0x0,
plog=0x0, ptemp=0x0, run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:268
#13 0x40332050 in modperl_callback_per_dir (idx=6, r=0x8239828, run_mode=MP_HOOK_RUN_FIRST)
at modperl_callback.c:356
#14 0x4032a0de in modperl_response_handler_run (r=0x8239828, finish=1) at mod_perl.c:905
#15 0x4032a20b in modperl_response_handler (r=0x8239828) at mod_perl.c:945
#16 0x806bbc9 in ap_run_handler (r=0x8239828) at config.c:151
#17 0x806c113 in ap_invoke_handler (r=0x8239828) at config.c:358
#18 0x80694d6 in ap_process_request (r=0x8239828) at http_request.c:246
#19 0x806539a in ap_process_http_connection (c=0x82338e8) at http_core.c:250
#20 0x8074078 in ap_run_process_connection (c=0x82338e8) at connection.c:42
#21 0x807434c in ap_process_connection (c=0x82338e8, csd=0x8233810) at connection.c:175
#22 0x806a850 in child_main (child_num_arg=1) at prefork.c:609
#23 0x806a9aa in make_child (s=0x80a1110, slot=1) at prefork.c:703
#24 0x806ab51 in perform_idle_server_maintenance (p=0x809f370) at prefork.c:838
#25 0x806aeef in ap_mpm_run (_pconf=0x809f370, plog=0x80c9418, s=0x80a1110) at prefork.c:1039
#26 0x807050e in main (argc=9, argv=0xbffff7a4) at main.c:617
#27 0x401d72eb in __libc_start_main (main=0x806fd90 <main>, argc=9, ubp_av=0xbffff7a4, init=0x8062778 <_init>,
fini=0x808742c <_fini>, rtld_fini=0x4000c130 <_dl_fini>, stack_end=0xbffff79c)
at ../sysdeps/generic/libc-start.c:129
This report was generated by ./REPORT on Sat Jul 17 14:48:07 2004 GMT.
-------------8<---------- End Bug Report --------------8<----------
Thanks,
- Adam Worrall
--
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] segfault when using IO::Socket::INET from within mod_perl1.9915
Posted by Chris Reinhardt <ch...@dyndns.org>.
On Jul 17, 2004, at 11:20 AM, Adam Worrall wrote:
> my $sock = IO::Socket::INET->new ({'Proto' => 'tcp',
> 'PeerAddr' => 'localhost',
> 'PeerPort' => 80});
>
I may be mistaken but I'm fairly sure that IO::Socket::INET takes a
list of arguments, not a hashref.
The code in IO::Socket::INET seems to reflect that:
sub new {
my $class = shift;
unshift(@_, "PeerAddr") if @_ == 1;
return $class->SUPER::new(@_);
}
While setting PeerAddr to a reference shouldn't cause a segfault (and
doesn't for me), it still might be something to keep in mind.
--
Chris Reinhardt -- chris@dyndns.org -- http://www.dyndns.org/
All sorts of computer errors are now turning up. You'd be surprised
to know the number of doctors who claim they are treating pregnant men.
--Isaac Asimov
--
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] segfault when using IO::Socket::INET from within mod_perl1.9915
Posted by Stas Bekman <st...@stason.org>.
>> I've used the bug template, and have a dist available at:
>> <http://worrall.cc/bug-reporting-skeleton-mp2.tar.gz>
And the tarball works fine for me on a pretty similar linux setup
(Mandrake) with the same perl and Apache components.
Though my libnss is different: libnss3-1.7-1mdk + glibc-2.3.3-10mdk
In addition to ldd, you could try to use strace and see what libs get
loaded in the pure-perl run vs. mp run.
--
__________________________________________________________________
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] segfault when using IO::Socket::INET from within mod_perl1.9915
Posted by Stas Bekman <st...@stason.org>.
Adam Worrall wrote:
> I'd be grateful for any ideas on where to push this next. I have a
> dodgy workaround, but it doesn't make me all that comfortable !
>
> -------------8<---------- Start Bug Report ------------8<----------
> 1. Problem Description:
Thanks for the detailed report, Adam :)
> Using IO::Socket::INET->new() causes a SIGSEGV
>
> The test code is pretty simple ...
> my $sock = IO::Socket::INET->new ({'Proto' => 'tcp',
> 'PeerAddr' => 'localhost',
> 'PeerPort' => 80});
>
> The problem seems to be down in libnss. It seems to get confused
> just after opening (the non-existent) /var/db/protocols.db, and
> then SISGEGVs. The same libnss works fine outside of mod_perl,
> via the same Perl & IO::Socket::INET; I guess there might be some
> interaction between mod_perl/Apache and libnss.
>
> libnss is part of libc, which for me is version 2.2.3 (slackware 9.1).
>
> The symptom vanishes by configuring /etc/nsswitch.conf to only
> use files for protocols (just delete the 'db' bit :), but I'm
> worried that the problem is still lying around, and could surface
> as some other random SIGSEGV.
>
> I've used the bug template, and have a dist available at:
> <http://worrall.cc/bug-reporting-skeleton-mp2.tar.gz>
Before we try that, is it possible that when you are running under mp2 a
different set of libraries get loaded? e.g. if Apache is linked against
conflicting set of the libs with the same names, but different versions?
Have you tried comparing the output of ldd on httpd, perl and
IO/Socket.so, it also could be statically linked.
--
__________________________________________________________________
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