php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60951 PHP-FPM leaks memory, crashes randomly
Submitted: 2012-02-01 23:04 UTC Modified: 2012-02-02 11:08 UTC
From: vytenis dot darulis at gmail dot com Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5.3.9 OS: Debian testing
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vytenis dot darulis at gmail dot com
New email:
PHP Version: OS:

 

 [2012-02-01 23:04 UTC] vytenis dot darulis at gmail dot com
Description:
------------
PHP-FPM crashes on restart (after ~12+ hours of runtime), virtual image size is 
always much larger than it should be (have to set request- building with --
enable-debug and report_memleaks=On reports a lot of memory leaks.


(gdb) bt
#0  0x0000000000619b3d in do_bind_function (opline=0x7f7f186ba960, 
    function_table=0x1115c50, compile_time=0 '\000')
    at /usr/src/php-5.3.9/Zend/zend_compile.c:2973
#1  0x0000000000654b7c in ZEND_DECLARE_FUNCTION_SPEC_HANDLER (
    execute_data=0x13be1c0) at /usr/src/php-5.3.9/Zend/zend_vm_execute.h:586
#2  0x000000000065490b in execute (op_array=0x14526c0)
    at /usr/src/php-5.3.9/Zend/zend_vm_execute.h:107
#3  0x00000000006329c9 in zend_execute_scripts (type=8, retval=0x0, 
    file_count=3) at /usr/src/php-5.3.9/Zend/zend.c:1236
#4  0x00000000005dfa8c in php_execute_script (primary_file=0x7fff185f3ef0)
    at /usr/src/php-5.3.9/main/main.c:2308
#5  0x0000000000429028 in main (argc=20419800, argv=0x0)
    at /usr/src/php-5.3.9/sapi/fpm/fpm/fpm_main.c:1858


#0  0x0000000000619b3d in do_bind_function (opline=0x7f7f186ba960, 
    function_table=0x1115c50, compile_time=0 '\000')
    at /usr/src/php-5.3.9/Zend/zend_compile.c:2973
        function = 0xdc32e0
#1  0x0000000000654b7c in ZEND_DECLARE_FUNCTION_SPEC_HANDLER (
    execute_data=0x13be1c0) at /usr/src/php-5.3.9/Zend/zend_vm_execute.h:586
No locals.
#2  0x000000000065490b in execute (op_array=0x14526c0)
    at /usr/src/php-5.3.9/Zend/zend_vm_execute.h:107
        ret = <optimized out>
        execute_data = 0x13be1c0
        nested = 1 '\001'
        original_in_execution = 0 '\000'
#3  0x00000000006329c9 in zend_execute_scripts (type=8, retval=0x0, 
    file_count=3) at /usr/src/php-5.3.9/Zend/zend.c:1236
        files = {{gp_offset = 40, fp_offset = 32639, 
            overflow_arg_area = 0x7fff185ef8c0, 
            reg_save_area = 0x7fff185ef850}}
        i = <optimized out>
        file_handle = 0x7fff185f3ef0
        orig_op_array = 0x0
        orig_retval_ptr_ptr = 0x0
#4  0x00000000005dfa8c in php_execute_script (primary_file=0x7fff185f3ef0)
---Type <return> to continue, or q <return> to quit---
    at /usr/src/php-5.3.9/main/main.c:2308
        realfile = " \021_\030\377\177", '\000' <repeats 18 times>, 
"B\367\bZ\177\177\000\000\001\000\000\000\177\177\000\000\001\000\000\000\000\00
0\000\000\310+GP\177\177\000\000\001\000\000\000\000\000\000\000\001\000\000\000
\000\000\000\000Д7\001\000\000\000\000\200\t_\030\377\177\000\000\206n\250X\177\
177\000\000\240\t_\030\377\177\000\000\000\000\000\000\000\000\000\000\001\000\0
00\000\000\000\000\000\177\352k\000\000\000\000\000\067\370\002\000\000\000\000\
000\300\033_\030\377\177\000\000\000\000\000\000\000\000\000\000\327tl\000\000\0
00\000\000\067\370\002\000\000\000\000\000&6\f\000\000\000\000\000\300\033_\030\
377\177\000\000\365\317k", '\000' <repeats 21 times>, 
"\001\005\000\001\000\000\000\000 
\223\067\001\000\000\000\000\300\033_\030\377\177\000\000\217\331k\000\000\000\0
00\000\200+\334\000\000\000\000\000\240"...
        __orig_bailout = 0x7fff185f3c10
        __bailout = {{__jmpbuf = {14430336, -6770098422908330243, 0, 20419800, 
              20419368, 0, -6770098428205736195, 6770589603805781757}, 
            __mask_was_saved = 0, __saved_mask = {__val = {0, 0, 0, 0, 
                20281744, 1, 20505256, 20419368, 0, 7418177, 140184908713798, 
                14429056, 140733602283248, 14429056, 20423224, 20505256}}}}
        prepend_file_p = <optimized out>
        append_file_p = 0x0
        prepend_file = {type = ZEND_HANDLE_FILENAME, filename = 0x0, 
          opened_path = 0x0, handle = {fd = 0, fp = 0x0, stream = {
              handle = 0x0, isatty = 0, mmap = {len = 0, pos = 0, map = 0x0, 
---Type <return> to continue, or q <return> to quit---
                buf = 0x0, old_handle = 0x0, old_closer = 0}, reader = 0, 
              fsizer = 0, closer = 0}}, free_filename = 0 '\000'}
        append_file = {type = ZEND_HANDLE_FILENAME, filename = 0x0, 
          opened_path = 0x0, handle = {fd = 0, fp = 0x0, stream = {
              handle = 0x0, isatty = 0, mmap = {len = 0, pos = 0, map = 0x0, 
                buf = 0x0, old_handle = 0x0, old_closer = 0}, reader = 0, 
              fsizer = 0, closer = 0}}, free_filename = 0 '\000'}
        old_cwd = 0x7fff185ef8d0 "/data-ssd/www/ywa/online_service/java"
        use_heap = 0 '\000'
        retval = 0
#5  0x0000000000429028 in main (argc=20419800, argv=0x0)
    at /usr/src/php-5.3.9/sapi/fpm/fpm/fpm_main.c:1858
        primary_script = 0x138c0b0 "/data-ssd/www/ywa/htdocs/index.php"
        __orig_bailout = 0x0
        __bailout = {{__jmpbuf = {4294967295, 6770588886464061181, 
              140733602283848, 3, 14305900, 0, -6770098422906233091, 
              6770589613499080445}, __mask_was_saved = 0, __saved_mask = {
              __val = {140184950204880, 140184908371680, 0, 0, 
                140184950155928, 140184950191312, 140184948057916, 
                140184908371968, 140184948057104, 4294967296, 4294969456, 1, 
                140184948092506, 140733602283056, 140733602282832, 
                140733602283240}}}}
        exit_status = 0
---Type <return> to continue, or q <return> to quit---
        c = 0
        file_handle = {type = ZEND_HANDLE_FP, 
          filename = 0x137a238 "/data-ssd/www/ywa/htdocs/index.php", 
          opened_path = 0x0, handle = {fd = 20281744, fp = 0x1357990, 
            stream = {handle = 0x1357990, isatty = 0, mmap = {len = 2721, 
                pos = 0, map = 0x7f7f176e8000, 
                buf = 0x7f7f176e8000 <Address 0x7f7f176e8000 out of bounds>, 
                old_handle = 0x1357990, 
                old_closer = 0x6460a0 <zend_stream_stdio_closer>}, 
              reader = 0x646190 <zend_stream_stdio_reader>, 
              fsizer = 0x6460d0 <zend_stream_stdio_fsizer>, 
              closer = 0x646120 <zend_stream_mmap_closer>}}, 
          free_filename = 0 '\000'}
        orig_optind = 1
        orig_optarg = 0x0
        ini_entries_len = <optimized out>
        max_requests = 120
        requests = 29
        fcgi_fd = <optimized out>
        request = {listen_socket = 0, fd = 3, id = 1, keep = 0, closed = 0, 
          in_len = 0, in_pad = 1, out_hdr = 0x0, 
          out_pos = 0x7fff185f1bf0 "\001\006", 
          out_buf = "\001\006\000\001\rK\005\000Expires: Thu, 19 Nov 1981 
08:52:---Type <return> to continue, or q <return> to quit---
00 GMT\r\nCache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0\r\nPragma: no-cache\r\nContent-type: application/xhtml+xml\r\n\r\n<?xml 
version=\"1"..., reserved = '\000' <repeats 15 times>, env = 0x13790d0}
        fpm_config = 0x7fff185f5f20 ""
        fpm_prefix = 0x0
        fpm_pid = 0x0
        test_conf = 0
        php_information = 0
        __func__ = "main"


gcc version 4.6.2 (Debian 4.6.2-11) 

./configure --build=x86_64-linux-gnu --disable-cli --prefix=/usr/local --enable-
fpm --disable-cgi --with-fpm-user=www-data --with-fpm-group=www-data --with-
config-file-path=/etc/php5/fpm --with-config-file-scan-dir=/etc/php5/fpm/conf.d 
--host=x86_64-linux-gnu --sysconfdir=/etc --localstatedir=/var --
mandir=/usr/share/man --disable-debug --with-regex=php --with-gd --enable-gd-
native-ttf --disable-rpath --disable-static --with-pic --with-layout=GNU --with-
pear=/usr/local/share/php --enable-fileinfo --enable-hash --enable-json --with-
bz2 --enable-ctype --without-db4 --without-gdbm --with-iconv --enable-mbstring -
-with-onig --with-pcre-regex --with-mysql-sock=/var/run/mysqld/mysqld.sock --
with-mysqli=shared --enable-pdo=shared --with-pdo-mysql=shared --without-pdo-
sqlite --enable-sockets --with-zlib --enable-zip --with-mhash=yes --without-mm -
-without-sybase-ct --without-mssql --without-sqlite3 --without-sqlite --with-
curl=/usr --with-mcrypt --disable-calendar --disable-phar --disable-tokenizer --
disable-posix --enable-simplexml --disable-dom --with-png-dir=/usr/lib/x86_64-
linux-gnu/ --with-jpeg-dir=/usr/lib/x86_64-linux-gnu/ --with-freetype-dir --
with-t1lib



[31-Jan-2012 09:20:03] WARNING: [pool www] child 10623 said into stderr: "===
Total 435 memory leaks detected ==="
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr: "[Tue
Jan 31 09:20:03 2012]  Script:  '-'"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr:
"/home/vd/php_exts/apc/APC-3.1.9/apc_zend.c(38) :  Freeing 0x019D3F78 (4 bytes),
script=-"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr: "Last
leak repeated 323 times"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr: "[Tue
Jan 31 09:20:03 2012]  Script:  '-'"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr:
"/usr/src/php-5.3.9/Zend/zend_hash.c(315) :  Freeing 0x019D7590 (76 bytes),
script=-"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr: "Last
leak repeated 1 time"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr: "[Tue
Jan 31 09:20:03 2012]  Script:  '-'"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr:
"/home/vd/php_exts/apc/APC-3.1.9/apc_compile.c(1657) :  Freeing 0x019DAB78 (232
bytes), script=-"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr: "Last
leak repeated 67 times"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr: "[Tue
Jan 31 09:20:03 2012]  Script:  '-'"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr:
"/usr/src/php-5.3.9/Zend/zend_hash.c(851) :  Freeing 0x019DCF68 (232 bytes),
script=-"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr:
"/usr/src/php-5.3.9/Zend/zend_hash.c(322) : Actual location (location was
relayed)"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr: "Last
leak repeated 1 time"
[31-Jan-2012 09:20:03] WARNING: [pool www] child 11098 said into stderr: "===
Total 396 memory leaks detected ==="


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-01 23:17 UTC] vytenis dot darulis at gmail dot com
Re-read "generating a backtrace" instructions on php.net, will update with more 
information as it turns out, a single script is responsible for those segfaults.
 [2012-02-01 23:25 UTC] vytenis dot darulis at gmail dot com
Uploaded the script that is indicated in the backtrace at 
http://darulis.lt/segf.txt
 [2012-02-02 10:53 UTC] vytenis dot darulis at gmail dot com
Sample process memory map - http://darulis.lt/memorymap.txt
 [2012-02-02 11:08 UTC] vytenis dot darulis at gmail dot com
Closing, this a duplicate of an older bug - https://bugs.php.net/bug.php?id=60383
 [2012-02-02 11:08 UTC] vytenis dot darulis at gmail dot com
-Status: Open +Status: Closed -Package: Reproducible crash +Package: APC
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 27 07:03:34 2022 UTC