php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8298 Apache segfaults with php module loaded.
Submitted: 2000-12-16 15:58 UTC Modified: 2000-12-28 19:34 UTC
From: ryan at guardiandigital dot com Assigned:
Status: Closed Package: Apache related
PHP Version: 4.0 Latest CVS (16/12/2000) OS: Linux 2.2.1[78]
Private report: No CVE-ID: None
 [2000-12-16 15:58 UTC] ryan at guardiandigital dot com
This is very wierd.  php all of a sudden stopped working when we upgraded to apache 1.3.14, and I have two different backtraces depending on the machine.

This problem originated with 4.0.3.pl1, but I saw a bug report saying it was fixed in CVS so I tried the latest tarball on snaps.php.net as of Friday 12/15.

Compile Options
------------
This is from the spec file I am using:

compile() {
./configure \
        --prefix=%{_prefix} \
        --sysconfdir=/etc \
        --with-config-file-path=/etc \
        --enable-pic \
        --enable-inline-optimization \
        --with-exec-dir=%{_bindir} \
        --with-regex=system \
        --with-gettext \
        --with-gdbm \
        --enable-magic-quotes \
        --enable-safe-mode \
        --enable-sysvsem \
        --enable-sysvshm \
        --enable-track-vars \
        --enable-ftp \
        --with-mysql=/usr \
        --disable-versioning \
        --with-xml \
        --with-zlib \
        --enable-debug \
        --disable-pear \
        --disable-yp \
        $*
make
}

Then I am doing comile --enable-shared to build the DSO and --enable-static to build the php standalone.

php.ini
------
I have played around with several options in here and I do not think it is the problem.  I can supply it upon request.

Machine 1
-----------
Apache only sefgaults when there is an "ErrorLog" directive inside of a "VirtualHost" directive.  Backtrace below

(gdb) bt full
#0  0x404914dc in pthread_handle_sigcancel (sig=134951340, ctx={gs = 62548, 
      __gsh = 2061, fs = 47914, __fsh = 2057, es = 0, __esh = 0, ds = 64172, 
      __dsh = 49151, edi = 135132244, esi = 3221224132, ebp = 134595447, 
      esp = 134943172, ebx = 134951340, edx = 1075379916, ecx = 3221224136, 
      eax = 3221224136, trapno = 3221224168, err = 134614136, eip = 134943172, 
      cs = 12716, __csh = 2059, eflags = 1075379916, 
      esp_at_signal = 134574437, ss = 4508, __ssh = 2059, 
      fpstate = 0x4018fecc, oldmask = 0, cr2 = 3221224248}) at pthread.c:663
        self = 0x1
        jmpbuf = (sigjmp_buf *) 0x80df454
#1  0x805c31a in open_error_log ()
No symbol table info available.
#2  0x805c377 in ap_open_logs ()
No symbol table info available.
#3  0x8060c78 in standalone_main ()
No symbol table info available.
#4  0x80614c3 in main ()
No symbol table info available.
#5  0x400b898b in __libc_start_main (main=0x806116c <main>, argc=2, 
    argv=0xbffffb84, init=0x804f2d4 <_init>, fini=0x80979dc <_fini>, 
    rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffb7c)
    at ../sysdeps/generic/libc-start.c:92
        argv = (char **) 0xbffffb84
        rtld_fini = (void (*)()) 0
        stack_end = (void *) 0x1


Machine 2
--------
Apache seems to always segfault if there is a VirtualHost directive... it looks to me like it chokes while trying to resolve the ServerName but I could be wrong.

(gdb) bt
#0  0x5a0b30 in ?? ()
#1  0x5abfaa in _nss_dns_gethostbyname_r (
    name=0xbffff660 "grepmaster.test.guardiandigital.com", result=0x2a2b64, 
    buffer=0x80e4198 "", buflen=1024, errnop=0x2a0a40, h_errnop=0xbffff648)
    at nss_dns/dns-host.c:162
#2  0x275c3f in __gethostbyname_r (
    name=0xbffff660 "grepmaster.test.guardiandigital.com", resbuf=0x2a2b64, 
    buffer=0x80e4198 "", buflen=1024, result=0xbffff644, h_errnop=0xbffff648)
    at ../nss/getXXbyYY_r.c:182
#3  0x274bd4 in gethostbyname (
    name=0xbffff660 "grepmaster.test.guardiandigital.com")
    at ../nss/getXXbyYY.c:137
#4  0x806d77e in ap_get_local_host ()
#5  0x80698da in ap_fini_vhost_config ()
#6  0x8057092 in ap_read_config ()
#7  0x8060c41 in standalone_main ()
#8  0x80614c3 in main ()
#9  0x1c898b in __libc_start_main (main=0x806116c <main>, argc=2, 
    argv=0xbffffba4, init=0x804f2d4 <_init>, fini=0x80979dc <_fini>, 
    rtld_fini=0x11ae60 <_dl_fini>, stack_end=0xbffffb9c)
    at ../sysdeps/generic/libc-start.c:92

I thank you all very much for your time.  If you need any more information please let me know and I will be happy to supply it.

Cheers,
Ryan

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-16 17:30 UTC] ryan at guardiandigital dot com
If it helps any, I was poking around through the glibc 2.1.3 ChangeLog (the version I am using) and found the following:

1999-09-12  Ulrich Drepper  <drepper@cygnus.com>

        * version.h (VERSION): Bump to 2.1.3.

        * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): if res_search
        fails don't rely on errno value.
        (getanswer_r): Sett *ERRNOP in error cases.

I hope this helps a little bit.  I seriously hope ths is not a glibc problem. :)
 [2000-12-17 12:14 UTC] sniper@php.net
Wouldn't using --with-apxs or --with-apache in your configure help?

--Jani
 [2000-12-18 08:04 UTC] ryan at guardiandigital dot com
Yeah, sorry for being rather vague in that respect.  Here are some more lines from my spec file:

# Build a standalone binary.
compile --enable-force-cgi-redirect
cp php php_standalone
make distclean

# Build a module.
compile --with-apxs=%{_sbindir}/apxs --enable-shared

Where compile() is the same as the first post.

Thanks,
Ryan
 [2000-12-28 19:34 UTC] sniper@php.net
Linking apache with pthread library solved this problem.

--Jani
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 12:01:26 2019 UTC