Closed p5pRT closed 21 years ago
the following test script "test.pl"
use strict; use Socket;
my $localhost_addr = pack('C4'\, 127\, 0\, 0\, 1); my $default_localhost = gethostbyaddr($localhost_addr\, Socket::AF_INET()) || 'localhost';
print "localhost=$default_localhost\n";
generates a "bus error" on execute ....
[root@server]perl test.pl Bus error
and\, here's the stack trace:
**********
Date/Time: 2002-06-01 18:40:32 -0700 OS Version: 10.1.4 (Build 5Q125) Host: server.internal.net
Command: perl PID: 24782
Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x700c92fc
Thread 0 Crashed: #0 0x70003b08 in memmove #1 0x00008540 in __res_vinit #2 0x00007624 in gen_res_get #3 0x000058f0 in net_data_create #4 0x0000582c in __net_data_init #5 0x00004340 in init #6 0x00003254 in gethostbyaddr #7 0x004658b8 in Perl_pp_ghostent #8 0x004656e4 in Perl_pp_ghbyaddr #9 0x003f8120 in Perl_runops_standard #10 0x00373eb8 in S_run_body #11 0x003739c4 in perl_run #12 0x00001c20 in main #13 0x00001a54 in _start #14 0x00001884 in start
PPC Thread State: srr0: 0x70003b08 srr1: 0x0000f030 vrsave: 0x00000000 xer: 0x00000020 lr: 0x00008540 ctr: 0x70003a00 mq: 0x00000000 r0: 0x10020035 r1: 0xbfffe650 r2: 0x700c930c r3: 0x700c92fc r4: 0x000fe740 r5: 0x00000000 r6: 0xac1e0a02 r7: 0x00000000 r8: 0x00000000 r9: 0x000fe720 r10: 0x00000000 r11: 0x0003350c r12: 0x70003a00 r13: 0x00000000 r14: 0x80008a98 r15: 0x8000219c r16: 0xbfffea88 r17: 0xbfffeaa8 r18: 0x8000214c r19: 0x00000000 r20: 0x00000001 r21: 0x87859393 r22: 0xc24bc195 r23: 0x87859393 r24: 0x8000213c r25: 0x00000000 r26: 0xbffff2a0 r27: 0x00000000 r28: 0x00000000 r29: 0x00000000 r30: 0xbfffe693 r31: 0x00007f90
this problem arises in building modperl2 on OSX.
the problem ID and the test script were kindly provided by the modperl2 author\, Doug MacEachern (thanks doug!):
regards\,
--------------------------------------
R Blake
blakers \
the following test script "test.pl"
use strict;
use Socket;
my $localhost_addr = pack('C4'\, 127\, 0\, 0\, 1);
my $default_localhost =
gethostbyaddr($localhost_addr\, Socket::AF_INET()) || 'localhost';
print "localhost=$default_localhost\n";
generates a "bus error" on execute ....
[root@server]perl test.pl
Bus error
and\, here's the stack trace:
**********
Date/Time: 2002-06-01 18:40:32 -0700
OS Version: 10.1.4 (Build 5Q125)
Host: server.internal.net
Command: perl
PID: 24782
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x700c92fc
Thread 0 Crashed:
#0 0x70003b08 in memmove
#1 0x00008540 in __res_vinit
#2 0x00007624 in gen_res_get
#3 0x000058f0 in net_data_create
#4 0x0000582c in __net_data_init
#5 0x00004340 in init
#6 0x00003254 in gethostbyaddr
#7 0x004658b8 in Perl_pp_ghostent
#8 0x004656e4 in Perl_pp_ghbyaddr
#9 0x003f8120 in Perl_runops_standard
#10 0x00373eb8 in S_run_body
#11 0x003739c4 in perl_run
#12 0x00001c20 in main
#13 0x00001a54 in _start
#14 0x00001884 in start
PPC Thread State:
srr0: 0x70003b08 srr1: 0x0000f030 vrsave: 0x00000000
xer: 0x00000020 lr: 0x00008540 ctr: 0x70003a00 mq: 0x00000000
r0: 0x10020035 r1: 0xbfffe650 r2: 0x700c930c r3: 0x700c92fc
r4: 0x000fe740 r5: 0x00000000 r6: 0xac1e0a02 r7: 0x00000000
r8: 0x00000000 r9: 0x000fe720 r10: 0x00000000 r11: 0x0003350c
r12: 0x70003a00 r13: 0x00000000 r14: 0x80008a98 r15: 0x8000219c
r16: 0xbfffea88 r17: 0xbfffeaa8 r18: 0x8000214c r19: 0x00000000
r20: 0x00000001 r21: 0x87859393 r22: 0xc24bc195 r23: 0x87859393
r24: 0x8000213c r25: 0x00000000 r26: 0xbffff2a0 r27: 0x00000000
r28: 0x00000000 r29: 0x00000000 r30: 0xbfffe693 r31: 0x00007f90
this problem arises in building modperl2 on OSX.
the problem ID and the test script were kindly provided by the modperl2
author\, Doug MacEachern (thanks doug!):
regards\,
--------------------------------------
R Blake
blakers \<\
http://homepage.mac.com/blakers
--------------------------------------
On Tuesday\, June 4\, 2002\, at 08:36 PM\, R Blake wrote:
use strict; use Socket;
my $localhost_addr = pack('C4'\, 127\, 0\, 0\, 1); my $default_localhost = gethostbyaddr($localhost_addr\, Socket::AF_INET()) || 'localhost';
print "localhost=$default_localhost\n";
generates a "bus error" on execute ....
[root@server]perl test.pl Bus error
For me the script is printing "localhost=localhost" as expected. Does this error occur only if you build mod_perl?
Do you have any special network setup\, i.e. anything non-standard in Netinfo?
What does:
use Socket; print unpack "C4"\,inet_aton("127.0.0.1");
print for you?
Kay
On Wed\, Jun 05\, 2002 at 01:51:57AM +0200\, Kay Röpke wrote:
On Tuesday\, June 4\, 2002\, at 08:36 PM\, R Blake wrote:
use strict; use Socket;
my $localhost_addr = pack('C4'\, 127\, 0\, 0\, 1); my $default_localhost = gethostbyaddr($localhost_addr\, Socket::AF_INET()) || 'localhost';
print "localhost=$default_localhost\n";
generates a "bus error" on execute ....
[root@server]perl test.pl Bus error
For me the script is printing "localhost=localhost" as expected.
As it does for me in Mac OS X 10.1.4.
-- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
On Thursday\, June 6\, 2002\, at 10:39 PM\, R Blake wrote:
fyi\,
i've now reproduced the problem on three different machines ......
running which OS X Release? BTW\, does this occur with 10.1.5\, too?
something in my build environment? or is it a bug?
Which versions of gcc did you use? Which Configure options did you use? perl -V outputs?
Does the error occur with the system supplied perl\, too? (that's perl5.6.0 )
What kind of hardware did you use? (Not that it should matter...x-( )
Do you have any beta software installed? Beta Builds of darwin\, OS X\, DevTools?
Kay
fyi\,
i've now reproduced the problem on three different machines ......
something in my build environment? or is it a bug?
richard
--On Wednesday\, June 5\, 2002 2:39 AM +0200 Kay Röpke \kroepke@​dolphin\-services\.de wrote:
On Wednesday\, June 5\, 2002\, at 02:05 AM\, R Blake wrote:
no\, nothing special ..... simple NAT behind firewall. all servers are in 172.30.x.x.
thoughts?
not yet :-( as it's already *way* past bedtime in my timezone i hitting the pillow.
kay
p.s.: it's generally a good idea to Cc: perl5-porters@perl.org in your replies. just in case someone has a moment of clarity (and for the archives ;-)
R Blake
blakers \
kay\,
--On Thursday\, June 6\, 2002 11:03 PM +0200 Kay Röpke \kroepke@​dolphin\-services\.de wrote:
fyi\,
i've now reproduced the problem on three different machines ......
running which OS X Release?
OSX Server 10.1.4
BTW\, does this occur with 10.1.5\, too?
not upgrading to 10.1.5 until the Server update is available too .....
something in my build environment? or is it a bug?
Which versions of gcc did you use?
2.95.2 ..... 3.1 on OSX is *not* ready for prime time!
Which Configure options did you use?
../Configure -Dfirstmakefile=GNUmakefile -Dusedevel
then MANUALLY entered the config opts .... entire session is documented ONLINE at http://homepage.mac.com/blakers
perl -V outputs?
[root@server]perl -V Summary of my perl5 (revision 5.0 version 8 subversion 0 patch 16982) configuration: Platform: osname=darwin\, osvers=5.4\, archname=darwin-thread-multi-stdio uname='darwin server.internal.net 5.4 darwin kernel version 5.4: wed apr 10 09:27:47 pdt 2002; root:xnuxnu-201.19.3.obj~1release_ppc power macintosh powerpc ' config_args='-Dfirstmakefile=GNUmakefile -Dusedevel' hint=previous\, useposix=true\, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n\, bincompat5005=undef Compiler: cc='cc'\, ccflags ='-pipe -fno-common -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -I/usr/include -I/usr/local/BerkeleyDB/include'\, optimize='-O3'\, cppflags='-pipe -fno-common -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -I/usr/include -I/usr/local/BerkeleyDB/include -pipe -fno-common -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -I/usr/include -I/usr/local/BerkeleyDB/include -pipe -fno-common -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -I/usr/include -I/usr/local/BerkeleyDB/include' ccversion=''\, gccversion='2.95.2 19991024 (release)'\, gccosandvers='' intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=4321 d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=8 ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8 alignbytes=8\, prototype=define Linker and Libraries: ld='cc'\, ldflags ='-flat_namespace -L/usr/local/lib -L/usr/X11R6/lib -L/usr/local/BerkeleyDB/lib' libpth=/usr/lib /usr/local/lib /usr/local/BerkeleyDB/lib /usr/X11R6/lib libs=-lbind -ldb -ldl -lm -lc perllibs=-lbind -ldl -lm -lc libc=/System/Library/Frameworks/System.framework/System\, so=dylib\, useshrplib=true\, libperl=libperl.dylib Dynamic Linking: dlsrc=dl_dyld.xs\, dlext=bundle\, d_dlsymun=undef\, ccdlflags=' ' cccdlflags=' '\, lddlflags='-flat_namespace -bundle -undefined suppress -L/usr/local/lib -L/usr/local/BerkeleyDB/lib -L/usr/X11R6/lib'
Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Locally applied patches: DEVEL16967 Built under darwin Compiled at Jun 3 2002 16:26:47 @INC: /usr/local/perl/lib/5.8.0/darwin /usr/local/perl/lib/5.8.0 /usr/local/perl/lib/site_perl/5.8.0/darwin /usr/local/perl/lib/site_perl/5.8.0 /usr/local/perl/lib/site_perl .
Does the error occur with the system supplied perl\, too? (that's perl5.6.0 )
i've\, unfortunately abandoned 5.6.0 long ago to start working w/ the apache2 compat branches .....
What kind of hardware did you use? (Not that it should matter...x-( )
here's the h/w environment
* Mac PPC/8500 * Sonnet Crescendo/G3 333 * 512 MB RAM * Orange Micro FireWire/USB * Sonnet Tempo RAID ATA Card * drives/partitions:
* 6 GB OSX partition * 10 GB OS9\, Apps & Tools partition * 20 GB "Developer" partition * separate 1GB swap partition * 30 GB "ports" partition * Asante 10/100 Ethernet * cable to the internet
* here's the s/w environment
* Ryan Rempel's OldWorld Mac support:
* XPostFacto 2.2b7 * L2CacheConfig
* MacOSX Server 10.1.4 * OSX Developer Tools (12/2001) * all latest Apple updates .....
Do you have any beta software installed? Beta Builds of darwin\, OS X\, DevTools?
no beta darwin\, no beta osx\, lots of tools chanmges\, pretty much bleeding-edge\, again as documented on http://homepage.mac.com/blakers
Kay
hope this helps ....
R Blake
blakers \
one more thing ......
i've been trying to ferret out this BusError problem on OSX with the test script:
use strict; use Socket;
my $localhost_addr = pack('C4'\, 172\, 30\, 10\, 2); my $default_localhost = gethostbyaddr($localhost_addr\, Socket::AF_INET()) ||
print "localhost=$default_localhost\n";
i note in the OSX man pages (http://www.hmug.org/man/3/gethostbyname.html) that:
Error return status from gethostbyname and gethostbyaddr is indicated by return of a null pointer. The external integer h_errno may then be checked to see whether this is a temporary failure or an invalid or unknown host. The routine herror can be used to print an error message describing the failure. If its argument string is non- NULL\, it is printed\, followed by a colon and a space. The error message is printed with a trailing newline.
also\, a quick look at "/etc/hosts" reveals:
## # Host Database # # Note that this file is consulted when the system is running in single-user # mode. At other times this information is handled by lookupd. By default\, # lookupd gets information from NetInfo\, so this file will not be consulted # unless you have changed lookupd's configuration. # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost
So\, a naive question: could this be a problem with NETINFO use on OSX?
I'm in new territory for this one\, so i'll keep digging .....
thanks for your help!
richard --On Thursday\, June 6\, 2002 11:03 PM +0200 Kay Röpke \kroepke@​dolphin\-services\.de wrote:
On Thursday\, June 6\, 2002\, at 10:39 PM\, R Blake wrote:
fyi\,
i've now reproduced the problem on three different machines ......
running which OS X Release? BTW\, does this occur with 10.1.5\, too?
something in my build environment? or is it a bug?
Which versions of gcc did you use? Which Configure options did you use? perl -V outputs?
Does the error occur with the system supplied perl\, too? (that's perl5.6.0 )
What kind of hardware did you use? (Not that it should matter...x-( )
Do you have any beta software installed? Beta Builds of darwin\, OS X\, DevTools?
Kay
R Blake
blakers \
On Sunday\, June 9\, 2002\, at 08:05 AM\, R Blake wrote:
one more thing ......
i've been trying to ferret out this BusError problem on OSX with the test script:
use strict; use Socket;
my $localhost_addr = pack('C4'\, 172\, 30\, 10\, 2); my $default_localhost = gethostbyaddr($localhost_addr\, Socket::AF_INET()) ||
print "localhost=$default_localhost\n";
I still can't reproduce the SEGV using gethostbyaddr\, whatever I feed it.
So\, a naive question: could this be a problem with NETINFO use on OSX?
No. NetInfo used to be the directory service of choice on NeXTStep\, and quite naturally still is on MacOS X. All requests which do not go to your nameserver are handled by your local NetInfo-server (otherwise you would have had a problem logging in ;-)) Since you are using your system\, your NetInfo-server works.
Actually I'm not convinced that this is a perl problem. Do you have access to a vanilla fresh innocent MacOS X Server installation? I would really be helpful to know if RC1 fails there\, too. Otherwise I would be tempted to blame your fire-and-forget opensourcing of OS X ;-)
Regards\,
Kay
kay\,
i think you may be right .....
i built a "vanilla" server and started comparing ....... actually an attempt to test mod_perl2 under apache2 may be pointing in the right direction (?) ....
per instructions\, i added:
LoadModule perl_module modules/mod_perl.so
to my httpd.conf file ......
without the LoadModule\, apache2 starts/runs fine ........ however\, *with* the LoadModule\, I get:
[root@server]apachectl restart dyld: /usr/local/apache2/sbin/httpd Undefined symbols: _endhostent _endnetent _endprotoent _endservent _freeaddrinfo _getaddrinfo _gethostbyaddr _gethostbyname _gethostent _getnetbyaddr _getnetbyname _getnetent _getprotobyname _getprotobynumber _getprotoent _getservbyname _getservbyport _getservent _sethostent _setnetent _setprotoent _setservent
Well that cam as a surprise ..... but would be consistent (?) with a problem when gethostbyaddr is called\, no?
now\, a quick look at the manpage: [root@server]man gethostbyname man: Formatting manual page...
GETHOSTBYNAME(3) GETHOSTBYNAME(3)
NAME gethostbyname\, gethostbyaddr\, gethostent\, sethostent\, end- hostent\, herror - get network host entry
SYNOPSIS #include \<netdb.h>
extern int h_errno;
struct hostent *gethostbyname(name) char *name;
struct hostent *gethostbyname2(name\, af) char *name; int af;
struct hostent *gethostbyaddr(addr\, len\, type) char *addr; int len\, type;
struct hostent *gethostent()
sethostent(stayopen) int stayopen;
endhostent()
herror(string) char *string;
shows that \<netdb.h> /usr/include/netdb.h -r--r--r-- 1 root wheel 9967 Sep 9 2001 /usr/include/netdb.h is involved ....... i then note that netdb.h has an error handler for calls to "gethostbyaddr"
that was on my "vanilla" system ..... so i searched for netdb.h on my "fire-n-forget" system\, and find .....
-rw-r--r-- 1 root wheel 17472 Jun 3 15:51 /usr/local/bind/bind/include/netdb.h -rw-r--r-- 1 root wheel 12902 Jun 3 15:50 /usr/local/bind/include/lwres/netdb.h -rw-r--r-- 1 root wheel 1335 Jun 3 15:50 /usr/local/bind/include/isc/netdb.h -rw-r--r-- 1 root wheel 12902 Jun 3 14:11 /Volumes/ServerSystem/ports/bind-9.2.1/lib/lwres/include/lwres/netdb.h -r--r--r-- 1 512 512 150 Dec 29 13:24 /Volumes/ServerSystem/ports/perl-current/win32/include/netdb.h -r--r--r-- 1 512 512 150 Dec 29 13:24 /Volumes/ServerSystem/ports/perl-current/wince/include/netdb.h -rw-r--r-- 1 102 234 5809 Dec 22 17:22 /Volumes/ServerSystem/ports/mysql-4.0.1-alpha/mit-pthreads/include/netdb.h -r--r--r-- 1 root wheel 9967 Sep 9 2001 /usr/include/netdb.h -rw-r--r-- 1 10132 wheel 12889 Aug 15 2001 /Volumes/ServerSystem/ports/bind-9.2.1/lib/lwres/include/lwres/netdb.h.in -rw-r--r-- 1 10132 wheel 17472 Jul 22 2001 /Volumes/ServerSystem/ports/bind-9.2.1/lib/bind/include/netdb.h -rw-r--r-- 1 10132 wheel 12847 Jul 18 2001 /Volumes/ServerSystem/ports/bind-9.2.1/lib/lwres/win32/include/lwres/netdb.h -rw-r--r-- 1 10132 wheel 4895 Jul 7 2001 /Volumes/ServerSystem/ports/bind-9.2.1/lib/isc/win32/netdb.h -rw-r--r-- 1 10132 wheel 1315 Jan 9 2001 /Volumes/ServerSystem/ports/bind-9.2.1/lib/isc/win32/include/isc/netdb.h -rw-r--r-- 1 10132 wheel 1335 Jan 9 2001 /Volumes/ServerSystem/ports/bind-9.2.1/lib/isc/unix/include/isc/netdb.h
clearly\, the BIND install (which works flawlessly\, by the way .....) seems to have "populated" my drive with netdb.h's!!
i haven't a clue (yet) what the differences are\, but have to wonder --- is netdb.h where the problem may lie? i'll keep poking around/thru\, but do you have any thoughts here? maybe a way to test the problem?
!!many!! thanks\,
richard
On Sunday\, June 9\, 2002\, at 08:05 AM\, R Blake wrote:
one more thing ......
i've been trying to ferret out this BusError problem on OSX with the test script:
use strict; use Socket;
my $localhost_addr = pack('C4'\, 172\, 30\, 10\, 2); my $default_localhost = gethostbyaddr($localhost_addr\, Socket::AF_INET()) ||
print "localhost=$default_localhost\n";
Actually I'm not convinced that this is a perl problem. Do you have access to a vanilla fresh innocent MacOS X Server installation? I would really be helpful to know if RC1 fails there\, too. Otherwise I would be tempted to blame your fire-and-forget opensourcing of OS X ;-)
Regards\,
Kay
R Blake
blakers \
test script:
use strict; use Socket;
my $localhost_addr = pack('C4'\, 127\, 0\, 0\, 1); my $default_localhost = gethostbyaddr($localhost_addr\, Socket::AF_INET()) ||
print "localhost=$default_localhost\n";
one more thing\, here's the output (until hang) of a perl debug session on the test script ....
main::(/usr/ports/temp/test.pl:4): 4: my $localhost_addr = pack('C4'\, 127\, 0\, 0\, 1); DB\<1> t Trace = on main::(/usr/ports/temp/test.pl:6): 6: my $default_localhost = gethostbyaddr($localhost_addr\, Socket::AF_INET()) || 'localhost'; Socket::AUTOLOAD(/usr/local/perl/lib/Socket.pm:388): 388: my($constname); Socket::AUTOLOAD(/usr/local/perl/lib/Socket.pm:389): 389: ($constname = $AUTOLOAD) =~ s/.*:://; Socket::AUTOLOAD(/usr/local/perl/lib/Socket.pm:390): 390: croak "&Socket::constant not defined" if $constname eq 'constant'; Socket::AUTOLOAD(/usr/local/perl/lib/Socket.pm:391): 391: my ($error\, $val) = constant($constname); Socket::AUTOLOAD(/usr/local/perl/lib/Socket.pm:392): 392: if ($error) { Socket::AUTOLOAD(/usr/local/perl/lib/Socket.pm:395): 395: *$AUTOLOAD = sub { $val }; Socket::AUTOLOAD(/usr/local/perl/lib/Socket.pm:396): 396: goto &$AUTOLOAD; Socket::__ANON__[/usr/local/perl/lib/Socket.pm:395](/usr/local/perl/lib/Soc ket.pm:395): 395: *$AUTOLOAD = sub { $val };
the session hangs fatally here ....... i'm not sure this sheds any further light ........
richard
hi\,
fyi\, i've managed to track down the "bus error" to a reproducible cause ........
the problems i was seeing with gethostbyaddr calls led me to believe that something was up with netdb.h and/or socket.h.
the perl -d trace on the test script also pointed to problems in socket.pm .......
the install of BIND-9.2.1 includes its own variety of netdb.h & socket.h headers\, so i took a partially educated guess that BIND was the problem.
i then realized that "-lbind" was found/included in the PERL build. so i rebuilt bleedperl from scratch\, and specifically did NOT include -lbind.
voila! problem (with BUS ERROR) gone. i cycled the problem a few times\, rebuilding perl on several machines w/ & w/o -lbind\, and the problem is reproducible.
soooooo\, no -lbind in PERL for now!
as to whether this is a PERL bug\, a BIND bug\, or something else ---- no idea\, for now ....
thoughts?
thanks!! to *both* of you for helping me track this down!
richard
R Blake
blakers \
I now added a bit of a warning about BIND to the INSTALL file (change #18191\, will be in Perl 5.8.1). I'm marking the problem ticket as resolved.
@jhi - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#9465 (status was 'resolved')
Searchable as RT9465$