Bug #75744 [Opn->Fbk]: Sporadic crashes when opcache enabled
| From: | cmb@php.net | Date: | Thu, 11 Feb 2021 13:15:21 +0000 |
| Subject: | Bug #75744 [Opn->Fbk]: Sporadic crashes when opcache enabled | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232058@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75744&edit=1
ID: 75744
Updated by: cmb@php.net
Reported by: kochuev at gmail dot com
Summary: Sporadic crashes when opcache enabled
-Status: Open
+Status: Feedback
Type: Bug
Package: opcache
Operating System: Oracle Linux
PHP Version: 7.0.26
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Do you still hit these segfaults with any of the actively
supported PHP versions[1]?
[1] <https://www.php.net/supported-versions.php>
Previous Comments:
------------------------------------------------------------------------
[2018-01-02 20:56:24] nikic@php.net
Are you using any 3rd party extensions? Especially something SHM based like apcu?
------------------------------------------------------------------------
[2018-01-02 20:44:05] kochuev at gmail dot com
We do have soap.wsdl_cache_enabled=1 but after a short test, it seems that setting that to 0 have no
effect on segfaults. Any idea what to try else?
------------------------------------------------------------------------
[2018-01-01 20:50:37] nikic@php.net
You mention that this may be related to SOAP -- do you have the WSDL memory cache enabled? In that
case this might be bug #75502, which may cause SOAP shutdown segfaults. Your traces don't quite
look like this problem though :/
------------------------------------------------------------------------
[2018-01-01 17:51:02] kochuev at gmail dot com
No, we are not using ZTS build and pthreads. Also as the problem appears only in the heavily loaded
situation it's hard to run valgrind on a sample script. Also, this is not a cli script, but
complex web system, so I'm not sure how to run php-fpm under valgrind.
One thing that I noticed is that the number of crashes a bit reduces (-30%) with the following
settings:
opcache.fast_shutdown=1
opcache.interned_strings_buffer=256
opcache.memory_consumption=1024
Btw all the crashes happen in the endpoints dealing with soap extension.
With opcache disabled number of crashes reduces -80%, but still, there are some, ex:
Program terminated with signal 11, Segmentation fault.
#0 zend_mm_alloc_small (size=<optimized out>, bin_num=6, heap=0x7f3ca6200040) at
/usr/src/debug/php-7.0.25/Zend/zend_alloc.c:1306
1306 heap->free_slot[bin_num] = p->next_free_slot;
#0 zend_mm_alloc_small (size=<optimized out>, bin_num=6, heap=0x7f3ca6200040) at
/usr/src/debug/php-7.0.25/Zend/zend_alloc.c:1306
#1 _emalloc_56 () at /usr/src/debug/php-7.0.25/Zend/zend_alloc.c:2380
#2 0x000055f14ae7e990 in _array_init (arg=arg@entry=0x7fff1c86aaf0, size=0) at
/usr/src/debug/php-7.0.25/Zend/zend_API.c:1059
#3 0x000055f14ae60a08 in zend_try_ct_eval_array (result=0x7fff1c86aaf0, ast=0x7f3c4cc46a58) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:5933
#4 0x000055f14ae600e8 in zend_eval_const_expr (ast_ptr=ast_ptr@entry=0x7fff1c86ab68) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:7577
#5 0x000055f14ae60c80 in zend_const_expr_to_zval (result=result@entry=0x7fff1c86abb0,
ast=ast@entry=0x7f3c4cc46a58) at /usr/src/debug/php-7.0.25/Zend/zend_compile.c:7036
#6 0x000055f14ae61470 in zend_compile_prop_decl (ast=ast@entry=0x7f3c4cc46ac0) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:5036
#7 0x000055f14ae676f2 in zend_compile_stmt (ast=0x7f3c4cc46ac0) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:7154
#8 0x000055f14ae682e7 in zend_compile_stmt_list (ast=ast@entry=0x7f3c4cd50878) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:4429
#9 0x000055f14ae6786e in zend_compile_stmt (ast=ast@entry=0x7f3c4cd50878) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:7095
#10 0x000055f14ae685f2 in zend_compile_class_decl (ast=ast@entry=0x7f3c4cdb9558) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:5376
#11 0x000055f14ae67a08 in zend_compile_stmt (ast=ast@entry=0x7f3c4cdb9558) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:7163
#12 0x000055f14ae6a05a in zend_compile_top_stmt (ast=0x7f3c4cdb9558) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:7069
#13 0x000055f14ae6a09f in zend_compile_top_stmt (ast=0x7f3c4cc46018) at
/usr/src/debug/php-7.0.25/Zend/zend_compile.c:7064
#14 0x000055f14ae4512d in compile_file (file_handle=<optimized out>, type=<optimized
out>) at Zend/zend_language_scanner.l:608
#15 0x00007f3c96c75920 in phar_compile_file (file_handle=<optimized out>, type=<optimized
out>) at /usr/src/debug/php-7.0.25/ext/phar/phar.c:3337
#16 0x000055f14ae4524d in compile_filename (type=8, filename=filename@entry=0x7f3ca6214ba0) at
Zend/zend_language_scanner.l:649
#17 0x000055f14af02777 in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER () at
/usr/src/debug/php-7.0.25/Zend/zend_vm_execute.h:29518
#18 0x000055f14aebb9eb in execute_ex (ex=<optimized out>) at
/usr/src/debug/php-7.0.25/Zend/zend_vm_execute.h:414
#19 0x000055f14ae6d59a in zend_call_function (fci=fci@entry=0x7fff1c86b4d0,
fci_cache=0x7f3ca6258700, fci_cache@entry=0x7fff1c86b4a0) at
/usr/src/debug/php-7.0.25/Zend/zend_execute_API.c:867
#20 0x000055f14ae9a793 in zend_call_method (object=0x7f3ca6256c68, obj_ce=<optimized out>,
fn_proxy=0x7f3ca6256c60, function_name=0x7f3ca625ff68 "autoloader::loadclass\001",
function_name_len=<optimized out>, retval_ptr=retval_ptr@entry=0x0,
param_count=param_count@entry=1, arg1=0x7f3ca6214b20, arg2=arg2@entry=0x0) at
/usr/src/debug/php-7.0.25/Zend/zend_interfaces.c:104
#21 0x000055f14ad80131 in zif_spl_autoload_call (execute_data=<optimized out>,
return_value=<optimized out>) at /usr/src/debug/php-7.0.25/ext/spl/php_spl.c:421
#22 0x000055f14ae6d61c in zend_call_function (fci=fci@entry=0x7fff1c86b760,
fci_cache=fci_cache@entry=0x7fff1c86b730) at /usr/src/debug/php-7.0.25/Zend/zend_execute_API.c:887
#23 0x000055f14ae6dcea in zend_lookup_class_ex (name=name@entry=0x7f3ca62a4560, key=0x7f3ca62f1820,
use_autoload=use_autoload@entry=1) at /usr/src/debug/php-7.0.25/Zend/zend_execute_API.c:1049
#24 0x000055f14ae6e6a8 in zend_fetch_class_by_name (class_name=0x7f3ca62a4560, key=<optimized
out>, fetch_type=fetch_type@entry=512) at /usr/src/debug/php-7.0.25/Zend/zend_execute_API.c:1395
#25 0x000055f14af00a54 in ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER () at
/usr/src/debug/php-7.0.25/Zend/zend_vm_execute.h:5679
#26 0x000055f14aebb9eb in execute_ex (ex=<optimized out>) at
/usr/src/debug/php-7.0.25/Zend/zend_vm_execute.h:414
#27 0x000055f14ae6d59a in zend_call_function (fci=fci@entry=0x7fff1c86b970,
fci_cache=0x7f3ca6368a20, fci_cache@entry=0x0) at
/usr/src/debug/php-7.0.25/Zend/zend_execute_API.c:867
#28 0x000055f14ae6dad9 in call_user_function_ex (function_table=function_table@entry=0x0,
object=object@entry=0x7fff1c86bae0, function_name=function_name@entry=0x7fff1c86bac0,
retval_ptr=retval_ptr@entry=0x7fff1c86bad0, param_count=<optimized out>, params=<optimized
out>, no_separation=no_separation@entry=1, symbol_table=symbol_table@entry=0x0) at
/usr/src/debug/php-7.0.25/Zend/zend_execute_API.c:675
#29 0x000055f14ae6db19 in call_user_function (function_table=function_table@entry=0x0,
object=object@entry=0x7fff1c86bae0, function_name=function_name@entry=0x7fff1c86bac0,
retval_ptr=retval_ptr@entry=0x7fff1c86bad0, param_count=<optimized out>, params=<optimized
out>) at /usr/src/debug/php-7.0.25/Zend/zend_execute_API.c:657
#30 0x00007f3c95ef41fb in zim_SoapServer_handle (execute_data=<optimized out>,
return_value=<optimized out>) at /usr/src/debug/php-7.0.25/ext/soap/soap.c:1863
#31 0x000055f14aefa4fb in ZEND_DO_FCALL_SPEC_HANDLER () at
/usr/src/debug/php-7.0.25/Zend/zend_vm_execute.h:842
#32 0x000055f14aebb9eb in execute_ex (ex=<optimized out>) at
/usr/src/debug/php-7.0.25/Zend/zend_vm_execute.h:414
#33 0x000055f14af0620f in zend_execute (op_array=0x7f3ca6273000, op_array@entry=0x7f3ca62ddea0,
return_value=return_value@entry=0x7f3ca6213420) at
/usr/src/debug/php-7.0.25/Zend/zend_vm_execute.h:458
#34 0x000055f14ae7c8f3 in zend_execute_scripts (type=type@entry=8, retval=0x7f3ca6213420,
retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/debug/php-7.0.25/Zend/zend.c:1445
#35 0x000055f14ae1c8a8 in php_execute_script (primary_file=primary_file@entry=0x7fff1c86e060) at
/usr/src/debug/php-7.0.25/main/main.c:2518
#36 0x000055f14acbbc74 in main (argc=<optimized out>, argv=<optimized out>) at
/usr/src/debug/php-7.0.25/sapi/fpm/fpm/fpm_main.c:1967
------------------------------------------------------------------------
[2017-12-29 17:52:16] nikic@php.net
Not seeing anything obvious in these traces. They do not look like something triggered by
protect_memory, so it's probably no simple SHM corruption.
Could it be that you are using a ZTS build of PHP?
Another thing that might or might not work is to run PHP under valgrind (using USE_ZEND_ALLOC=0
ZEND_DONT_UNLOAD_MODULES=1 valgrind php [args]) and see if this produces reliable memory errors.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=75744
--
Edit this bug report at https://bugs.php.net/bug.php?id=75744&edit=1