Segfault after apache reload

Issue #12 invalid
ggrundik created an issue

Apache2 segfaults after reload in this library with the following trace:

$ gdb apache2 /var/tmp/apache/core 
GNU gdb (Debian 7.9-1) 7.9
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from apache2...Reading symbols from /usr/lib/debug//usr/sbin/apache2...done.
done.
[New LWP 3682119]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/sbin/apache2 -k start'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f652d7059ae in ?? () from /usr/lib/php5/20131226/ev.so
(gdb) file /usr/lib/php5/20131226/ev.so
warning: core file may not match specified executable file.
Load new symbol table from "/usr/lib/php5/20131226/ev.so"? (y or n) y
Reading symbols from /usr/lib/php5/20131226/ev.so...done.
(gdb) bt full
#0  0x00007f652d7059ae in ?? () from /usr/lib/php5/20131226/ev.so
No symbol table info available.
#1  0x00007f653b5a9292 in __libc_fork () at ../sysdeps/nptl/fork.c:89
        newp = <optimized out>
        oldval = <optimized out>
        pid = <optimized out>
        allp = 0x0
        runp = 0x0
        ppid = <optimized out>
        parentpid = <optimized out>
        __PRETTY_FUNCTION__ = "__libc_fork"
#2  0x0000000b2baff200 in ?? ()
No symbol table info available.
#3  0x000000013c643a80 in ?? ()
No symbol table info available.
#4  0xad6eaefb2baff200 in ?? ()
No symbol table info available.
#5  0x00007f653c642ef8 in ?? ()
No symbol table info available.
#6  0x00007f653bad1e0e in apr_proc_other_child_alert (proc=<optimized out>, reason=<optimized out>, status=<optimized out>)
    at /tmp/buildd/apr-1.5.1/misc/unix/otherchild.c:115
        ocr = <optimized out>
        nocr = <optimized out>
#7  0x00007f65381ff56e in prefork_run (_pconf=0x0, plog=0x7f6539247d88, s=0x3b657711) at prefork.c:1056
        status = 11
        pid = {pid = 3682117, in = 0x7f653bac6036 <find_entry+134>, out = 0x0, err = 0x7f653c41cf60}
        child_slot = 958689971
        exitwhy = (APR_PROC_SIGNAL | APR_PROC_SIGNAL_CORE)
        processed_status = 1374231940
        rv = 762337710
#8  0x00007f653c3e0eee in ?? ()
No symbol table info available.
#9  0x00007f653c398118 in ?? ()
No symbol table info available.
#10 0x00007f653c642ef8 in ?? ()
No symbol table info available.
#11 0x00007f653c396028 in ?? ()
No symbol table info available.
#12 0x00007f653c63f1c0 in ?? ()
No symbol table info available.
#13 0x00007f653c642ed0 in ?? ()
No symbol table info available.
#14 0x00007f653c3da413 in ?? ()
No symbol table info available.
#15 0x00007fff51ef01d8 in ?? ()
No symbol table info available.
#16 0x00007f653c41c523 in ?? ()
No symbol table info available.
#17 0x00007f653c41c516 in ?? ()
No symbol table info available.
#18 0x000000003b89b820 in ?? ()
No symbol table info available.
#19 0x0000000000000000 in ?? ()
No symbol table info available.
$ apache2 -v
Server version: Apache/2.4.12 (Debian)
Server built:   Apr 28 2015 21:00:46

Im using ev version 0.2.13. Unfortunately all my attempts to include required debug information in ev.so was unsuccessful: even with "-O0 -ggdb3" build gdb still complains, that where is no symbol table info.

Error is reproducible in 100% of runs, apache2 always segfaults, even if requested URL has nothing to do with PHP. As I can see from trace, segfault happens at forking stage, when apache2 creates request processing child.

After apache restart an error is gone. Until next reload, which happens every day (thanks to logrotate). Thats very inconvenient behavior.

Comments (6)

  1. Ruslan Osmanov repo owner

    Oh, you run it under Apache. This extension is actually intended to be run from command line (CLI SAPI) (only).

    I've modified config.m4 correspondingly.

  2. ggrundik reporter

    If this module supports only CLI SAPI, not whether it should block/mock itself, instead of weird crashing? By default PHP extensions added for all installed SAPIs.

  3. Log in to comment