From:
Operating system: Debian testing
PHP version: 5.3.9
Package: Reproducible crash
Bug Type: Bug
Bug description:PHP-FPM leaks memory, crashes randomly
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 ==="
--
Edit bug report at https://bugs.php.net/bug.php?id=60951&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60951&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60951&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60951&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60951&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60951&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60951&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60951&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60951&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60951&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60951&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60951&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60951&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60951&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60951&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60951&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60951&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60951&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60951&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60951&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60951&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60951&r=mysqlcfg