[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: Apache 1.3.9 + mod_perl 1.21 + Solaris 2.7 dumps core



"Frank D. Cringle" wrote:

> Apache reloads itself during initial startup, to ensure that possible
> configuration errors that might cause problems later (e.g. when
> rotating logs) are caught as soon as possible.  The combination of
> this procedure with mod_perl and certain operating systems leads to
> the symptoms that you are seeing.  Typically, a SEGV is occurs when
> accessing the boot routine of the first dynamically-loaded perl-XS
> module.  Close tracing will show that it happens the second time
> through, during the trial reload, and that the symbol table used by
> dlopen has been shot to hell.  If you can find and fix this bug, you
> will be awarded the mod_perl Nobel prize.

I claim the prize, or at least a mention on the citation ;-)

Your comment about dlopen set me thinking.  There is a little-known
feature on Solaris that allows you to debug the operation of ld.so.1. 
Here's a flavour:

$ LD_DEBUG=basic ./httpd
-X                                                                                                   
06988: 
06988: calling init: /usr/lib/libc.so.1
06988: 
06988: 
06988: calling init: /usr/lib/libmp.so.2
06988: 
06988: 
06988: calling init: /usr/lib/libnsl.so.1
06988: 
06988: 
06988: calling init: /usr/lib/libsocket.so.1
06988: 
06988: 
06988: transferring control: ./httpd
06988: 
06988: 
06988: cyclic objects for .init  (before sorting)
06988:     [2] 
/home1/software/perl/debug/lib/5.00503/sun4-solaris/CORE/libperl.so
06988:     [1]  /home2/web/apache_1.3.9/libexec/libperl.so
06988: 
06988: cyclic objects for .init  (after sorting)
06988:     [2] 
/home1/software/perl/debug/lib/5.00503/sun4-solaris/CORE/libperl.so
06988:     [1]  /home2/web/apache_1.3.9/libexec/libperl.so
06988: 
06988: calling init: /usr/lib/libgen.so.1
06988: 
06988: 
06988: calling init: /usr/lib/libcrypt_i.so.1
06988: 
06988: 
06988: calling init:
/home1/software/perl/debug/lib/5.00503/sun4-solaris/CORE/libperl.so
06988: 
06988: 
06988: calling init: /home2/web/apache_1.3.9/libexec/libperl.so
06988: 
06988: 
06988: calling init:
/home1/software/perl/debug/lib/5.00503/sun4-solaris/auto/Data/Dumper/Dumper.so
06988: 
06988: 
06988: calling init:
/home1/software/perl/debug/lib/5.00503/sun4-solaris/auto/B/B.so
06988: 
Segmentation Fault(coredump)

What that is saying is that the .init sections (pre-execution
initialisation code) of the perl libperl.so and the libexec libperl.so
have a cyclic dependency.  I figured that sod's law meant that the order
that ld.so.1 chose to pull the libraries in was the wrong order, so I
tried the following to reverse the binding order:

$ LD_PRELOAD='/home2/web/apache_1.3.9/libexec/libperl.so \
/home1/software/perl/debug/lib/5.00503/sun4-solaris/CORE/libperl.so'
./httpd
$

hey presto!  A working httpd.  Obviously this is just a workaround - the
real fix is to identify the cyclic dependencies and fix them properly.

Alan Burlison


References to:
Ilya Zakharevich <ilya@math.ohio-state.edu>
Alan Burlison <Alan.Burlison@uk.sun.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]