[H-GEN] Apache segfaulting... how to debug

Michael Anthon michael at anthon.net
Thu Jul 10 01:49:33 EDT 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

> I'm starting to think that this is perhaps a fault in the Oracle libs 
> that the php4 oci8 module is linked against.
> 
> bash> ldd /usr/lib/php4/20020429/oci8.so
>         libclntsh.so.8.0 => /oracle/as9i/lib/libclntsh.so.8.0 (0x40010000)
>         libc.so.6 => /lib/libc.so.6 (0x405d6000)
>         libwtc8.so => /oracle/as9i/lib/libwtc8.so (0x406e6000)
>         libdl.so.2 => /lib/libdl.so.2 (0x406ee000)
>         libm.so.6 => /lib/libm.so.6 (0x406f1000)
>         libpthread.so.0 => /lib/libpthread.so.0 (0x40712000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
> 

I just took a stab at doing something that seemed to make sense to me. 
If my theory was correct then if I could access a page that used the 
oracle libs and also find out what the pid of the thread that handled 
the request was I should be able to attach gdb to that process and trap 
the segfault...

So I added
	passthru('echo $PPID');

to the tail of my script and got the parent pid for the shell used to 
execute the echo which just happens to be the apache child process.

> bash> gdb /usr/sbin/apache 19322
> GNU gdb 5.0.90-cvs (MI_OUT)
> Copyright 2001 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i686-pc-linux-gnu"...(no debugging symbols found)...
> /usr/src/19322: No such file or directory.
> Attaching to program: /usr/sbin/apache, process 19322
> Reading symbols from /lib/libpthread.so.0...(no debugging symbols found)...done.
> [New Thread 16384 (LWP 19322)]
> Loaded symbols for /lib/libpthread.so.0
> Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done.
<snipped lots of similar lib loading messages>
> Reading symbols from /usr/lib/libltdl.so.3...done.
> Loaded symbols for /usr/lib/libltdl.so.3
> Reading symbols from /lib/libnss_dns.so.2...done.
> Loaded symbols for /lib/libnss_dns.so.2
> 0x402407f2 in semop () from /lib/libc.so.6
> (gdb) cont
> Continuing.
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 16384 (LWP 19322)]
> 0x44ec5c2c in epc_exit_handler () from /oracle/as9i/lib/libclntsh.so.8.0
> (gdb) bt
> #0  0x44ec5c2c in epc_exit_handler () from /oracle/as9i/lib/libclntsh.so.8.0
> Cannot access memory at address 0x44ec5c2c

So... the theory seems to stack up and I have a reasonable method to 
force the fault to occur.

Cheers
Michael


--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list