Skip to Content.
Sympa Menu

freetds - Re: apache php module crashing when accessing freet ds libraries

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Chris <ccortner AT cvol.net>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: apache php module crashing when accessing freet ds libraries
  • Date: 17 Nov 2002 20:16:22 -0600


I just witnessed a change in behavior that may be helpful. Im not sure
what caused this to happen. I had in a previous gdb session set a
breakpoint at the w2() function after It hit the breakpoint in main().
Its been doing this since.

[root@Fear-Linux bin]# gdb httpd
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 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 "i386-redhat-linux"...
(gdb) handle SIGTRAP nopass nostop
SIGTRAP is used by the debugger.
Are you sure you want to change it? (y or n) y
Signal Stop Print Pass to program Description
SIGTRAP No Yes No Trace/breakpoint trap
(gdb) break main
Breakpoint 1 at 0x8048999
(gdb) break __libc_start_main
Breakpoint 2 at 0x8048894
(gdb) run
Starting program: /www/bin/httpd -X
Breakpoint 2 at 0x42015836

Breakpoint 2, 0x42015836 in __libc_start_main () from
/lib/i686/libc.so.6
(gdb) continue
Continuing.

Breakpoint 1, 0x08048999 in main ()
(gdb) continue
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
[Sun Nov 17 20:10:31 2002] [alert] httpd: Could not determine the
server's fully qualified domain name, using 127.0.0.1 for ServerName

---Loading page in Mozilla, Works properly ---
---Ctrl-C ------

Program received signal SIGINT, Interrupt.
0x420cdb44 in read () from /lib/i686/libc.so.6
(gdb) bt
#0 0x420cdb44 in read () from /lib/i686/libc.so.6
#1 0x400888d4 in doContent () from /usr/lib/libexpat.so.0
#2 0x40043c97 in __ieee754_lgammaf_r () from /lib/i686/libm.so.6
#3 0x40043c54 in __ieee754_lgammaf_r () from /lib/i686/libm.so.6
#4 0x4004276a in __ieee754_acosf () from /lib/i686/libm.so.6
#5 0x40042abf in __ieee754_j0f () from /lib/i686/libm.so.6
#6 0x40054101 in pio2_lo () from /lib/i686/libm.so.6
#7 0x400543f2 in S () from /lib/i686/libm.so.6
#8 0x40054cdb in tpi () from /lib/i686/libm.so.6
#9 0x40051377 in _fini () from /lib/i686/libm.so.6
#10 0x40051574 in _fini () from /lib/i686/libm.so.6
#11 0x400516fe in _fini () from /lib/i686/libm.so.6
#12 0x40051db4 in qS2 () from /lib/i686/libm.so.6
#13 0x4005267c in w2 () from /lib/i686/libm.so.6
#14 0x080485b3 in ?? ()
#15 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) continue
Continuing.

--- Clicking Refresh In Mozilla ---

Program received signal SIGSEGV, Segmentation fault.
0x420741ee in malloc_consolidate () from /lib/i686/libc.so.6
(gdb) bt
#0 0x420741ee in malloc_consolidate () from /lib/i686/libc.so.6
#1 0x42073ab7 in _int_malloc () from /lib/i686/libc.so.6
#2 0x42073155 in malloc () from /lib/i686/libc.so.6
#3 0x402075fc in ?? ()
#4 0x401b8e29 in ?? ()
#5 0x401f77f0 in ?? ()
#6 0x401f77b4 in ?? ()
#7 0x401f7ff6 in ?? ()
#8 0x401f03d1 in ?? ()
#9 0x401ef5db in ?? ()
#10 0x40225525 in ?? ()
#11 0x40225f65 in ?? ()
#12 0x402260fa in ?? ()
#13 0x400446f0 in __ieee754_scalbf () from /lib/i686/libm.so.6
#14 0x4005a9f3 in __init_des_r () from /lib/libcrypt.so.1
#15 0x4005aa65 in __init_des_r () from /lib/libcrypt.so.1
#16 0x400513b5 in _fini () from /lib/i686/libm.so.6
#17 0x40051574 in _fini () from /lib/i686/libm.so.6
#18 0x400516fe in _fini () from /lib/i686/libm.so.6
#19 0x40051db4 in qS2 () from /lib/i686/libm.so.6
#20 0x4005267c in w2 () from /lib/i686/libm.so.6
#21 0x080485b3 in ?? ()
#22 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) quit
The program is running. Exit anyway? (y or n) y
[root@Fear-Linux bin]#
Script done on Sun Nov 17 20:11:25 2002

Interesting
Chris - ccortner AT cvol.net

On Sun, 2002-11-17 at 19:34, Chris wrote:
> It doesn't look like we will be able to tell where things are breaking
> by these backtraces. Perhaps it would be helpful if I compiled php into
> apache instead of as a module. I came across two scenarios. One if I
> tried to access the php script from mozilla or konqueror (this is the
> full version of the backtrace I posted before)
>
> #0 0x4020dc12 in ?? ()
> #1 0x4022164d in ?? ()
> #2 0x402152b9 in ?? ()
> #3 0x401f0a04 in ?? ()
> #4 0x402255a2 in ?? ()
> #5 0x40225f65 in ?? ()
> #6 0x402260fa in ?? ()
> #7 0x400446f0 in __ieee754_scalbf () from /lib/i686/libm.so.6
> #8 0x4005a9f3 in __init_des_r () from /lib/libcrypt.so.1
> #9 0x4005aa65 in __init_des_r () from /lib/libcrypt.so.1
> #10 0x400513b5 in _fini () from /lib/i686/libm.so.6
> #11 0x40051574 in _fini () from /lib/i686/libm.so.6
> #12 0x400516fe in _fini () from /lib/i686/libm.so.6
> #13 0x40051db4 in qS2 () from /lib/i686/libm.so.6
> #14 0x4005267c in w2 () from /lib/i686/libm.so.6
> #15 0x080485b3 in ?? ()
> #16 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
>
> The second is what happens when I use the links console web browser. In
> this case the first time I access the page it works!? but if I reload
> the page I get a segfault again. Here is that backtrace.
>
>
> #0 0x420741ee in malloc_consolidate () from /lib/i686/libc.so.6
> #1 0x42073ab7 in _int_malloc () from /lib/i686/libc.so.6
> #2 0x42073155 in malloc () from /lib/i686/libc.so.6
> #3 0x402075fc in ?? ()
> #4 0x401b8e29 in ?? ()
> #5 0x401f77f0 in ?? ()
> #6 0x401f77b4 in ?? ()
> #7 0x401f7ff6 in ?? ()
> #8 0x401f03d1 in ?? ()
> #9 0x401ef5db in ?? ()
> #10 0x40225525 in ?? ()
> #11 0x40225f65 in ?? ()
> #12 0x402260fa in ?? ()
> #13 0x400446f0 in __ieee754_scalbf () from /lib/i686/libm.so.6
> #14 0x4005a9f3 in __init_des_r () from /lib/libcrypt.so.1
> #15 0x4005aa65 in __init_des_r () from /lib/libcrypt.so.1
> #16 0x400513b5 in _fini () from /lib/i686/libm.so.6
> #17 0x40051574 in _fini () from /lib/i686/libm.so.6
> #18 0x400516fe in _fini () from /lib/i686/libm.so.6
> #19 0x40051db4 in qS2 () from /lib/i686/libm.so.6
> #20 0x4005267c in w2 () from /lib/i686/libm.so.6
> #21 0x080485b3 in ?? ()
> #22 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
>
> It looks like most of apache itself is compiled into a library called
> libhttpd.so
>
> I think the program executes like this
> httpd->libc.so.6->libhttpd.so->libphp4.so->tds
>
> Is gdb even able to dig into dll's like this. Here is a portion of the
> script I created. I'm not sure If I was supposed to attach it as a file
> or just paste it, let me know.
>
> [root@Fear-Linux bin]# gdb httpd
> GNU gdb Red Hat Linux (5.2.1-4)
> Copyright 2002 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 "i386-redhat-linux"...
> (gdb) handle SIGTRAP nostop nopass
> SIGTRAP is used by the debugger.
> Are you sure you want to change it? (y or n) y
> Signal Stop Print Pass to program Description
> SIGTRAP No Yes No Trace/breakpoint trap
> (gdb) break main
> Breakpoint 1 at 0x8048999
> (gdb) break __libc_start_main
> Breakpoint 2 at 0x8048894
> (gdb) run
> Starting program: /www/bin/httpd -X
> Breakpoint 2 at 0x42015836
>
> Breakpoint 2, 0x42015836 in __libc_start_main () from
> /lib/i686/libc.so.6
> (gdb) continue
> Continuing.
>
> Breakpoint 1, 0x08048999 in main ()
> (gdb) continue
> Continuing.
>
> Program received signal SIGTRAP, Trace/breakpoint trap.
> [Sun Nov 17 19:12:16 2002] [alert] httpd: Could not determine the
> server's fully qualified domain name, using 127.0.0.1 for ServerName
>
> --- loading web page in mozilla -----
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x402076fb in ?? ()
> (gdb) bt
>
> --- same bt as above. ----
>
> Thats as thorough as I know how to be.. This is certainly educational if
> anything. :) Let me know what else I can do that would be helpful
>
> PS. I also have a tdsdump for the run with links. I can post that as
> well if you'd like. Basically it contains one run which looks completely
> normal and then the second run when I try to reload the page which
> abruptly ends before even talking to the database.
> ---successful run ----
> ---bunch of init stuff ----
> pid: 2859:2002-11-17 19:29:16.406918 ... Found section jdbc.
> pid: 2859:2002-11-17 19:29:16.407066 ...Success.
> pid: 2859:2002-11-17 19:29:16.407215 Setting 'dump_file' to
> '/tmp/freetds.log.2859' from $TDSDUMP.
> --crash nothing ---
> :|
>
> Later
> Chris - ccortner AT cvol.net
>
>
>
>
>
> > "bt 9" lists 9 levels of calling stack. Your breakage is evidently so
> > deep that you're not in FreeTDS or PHP, but somewhere in libc or
> > something, which is almost certainly stripped. You're in the midst of
> > some floating point work, I think, based on "libm" (math) and
> > "__ieee754_scalbf" (written by someone who knows what a mantissa is).
> >
> > Try just "bt" or some values >9, to see if you can tell where the call
> > leaves PHP and how. I have a bad feeling about what's going on: it might
> > be that FreeTDS returned some bogus string, which PHP didn't notice,
> > passed on for computation, and some low-level wound up with nonsense input
> > it wasn't designed to handle. The usual thing: a string of bad luck (no
> > pun intended).
> >
> > When I first read you message I thought, oh, this will never work. Now
> > I'm more optimistic. I think at least you're going to be able to tell
> > where we leave PHP and how and with what, and I think that's going to take
> > us in the right direction.
> >
> > I wish this was easier. I'm glad it's possible.
> >
> > Regards,
> >
> > --jkl
> >
> > ---
> > You are currently subscribed to freetds as: [ccortner AT cvol.net]
> > To unsubscribe, forward this message to $subst('Email.Unsub')
> > ---
> > [This E-mail scanned for viruses by Declude Virus]
> >
> >
>
>
> ---
> [This E-mail scanned for viruses by Declude Virus]
>
>
> ---
> You are currently subscribed to freetds as: [ccortner AT cvol.net]
> To unsubscribe, forward this message to $subst('Email.Unsub')
> ---
> [This E-mail scanned for viruses by Declude Virus]
>
>
>


---
[This E-mail scanned for viruses by Declude Virus]





Archive powered by MHonArc 2.6.24.

Top of Page