php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78204 Segmentation fault in php-fpm with opcache enabled
Submitted: 2019-06-25 09:10 UTC Modified: 2021-06-20 04:22 UTC
Votes:6
Avg. Score:4.8 ± 0.4
Reproduced:6 of 6 (100.0%)
Same Version:6 (100.0%)
Same OS:3 (50.0%)
From: ixghzx at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: *General Issues
PHP Version: 7.3.6 OS: CentOS 7
Private report: No CVE-ID: None
 [2019-06-25 09:10 UTC] ixghzx at gmail dot com
Description:
------------
With Magento projects, php-fpm processes start crashing in several minutes(usually 10-15 minutes) after starting the master php-fpm process. They keep crashing until the master process is restarted. Crashes never happen with opcache disabled or in PHP 7.2(configured and compiled with the same options). This behavior doesn't depend on compiler options(crashes occurred with binaries made with gcc and clang). This issue prevents us from upgrading to PHP 7.3. 

php-fpm pool is configured as 'pm = ondemand'

This backtrace report was obtained from the core dump of the binary compiled with options "-g -01"

Program terminated with signal 11, Segmentation fault.
#0  zend_mm_alloc_small (heap=<optimized out>, size=<optimized out>, bin_num=7) at Zend/zend_alloc.c:1289

(gdb) bt
#0  zend_mm_alloc_small (heap=<optimized out>, size=<optimized out>, bin_num=7) at Zend/zend_alloc.c:1289
#1  zend_mm_alloc_heap (heap=0x7f651ac00040, size=<optimized out>) at Zend/zend_alloc.c:1360
#2  _emalloc (size=<optimized out>) at Zend/zend_alloc.c:2500
#3  0x000000000081e722 in zend_string_alloc (len=<optimized out>, persistent=<optimized out>) at Zend/zend_string.h:133
#4  zend_string_tolower_ex (str=0x7f65075d71d8, persistent=0) at Zend/zend_operators.c:2677
#5  0x0000000000805e36 in zend_add_class_name_literal (op_array=0x7f650607a2a0, name=0x106d718) at Zend/zend_compile.c:563
#6  0x00000000008097c3 in zend_compile_class_decl (ast=0x7f6505cddf68) at Zend/zend_compile.c:6416
#7  0x000000000080ae64 in zend_compile_stmt (ast=0x7f6505cddf68) at Zend/zend_compile.c:8289
#8  0x000000000080f011 in zend_compile_top_stmt (ast=0x7f6505cddf68) at Zend/zend_compile.c:8195
#9  0x000000000080effa in zend_compile_top_stmt (ast=0x7f6505cdd018) at Zend/zend_compile.c:8190
#10 0x00000000007f0cd4 in zend_compile (type=2) at Zend/zend_language_scanner.l:602
#11 0x00000000007f0baf in compile_file (file_handle=0x7ffd85ed0728, type=2) at Zend/zend_language_scanner.l:636
#12 0x00000000006b17b8 in phar_compile_file (file_handle=0x7ffd85ed0728, type=2) at ext/phar/phar.c:3347
#13 0x00007f6514464790 in opcache_compile_file (file_handle=0x7ffd85ed0728, type=<optimized out>, key=<optimized out>, op_array_p=0x7ffd85ed0648) at ext/opcache/ZendAccelerator.c:1760
#14 0x00007f6514464fa2 in persistent_compile_file (file_handle=0x7ffd85ed0728, type=2) at ext/opcache/ZendAccelerator.c:2105
#15 0x00000000007f0dde in compile_filename (type=2, filename=0x7f651ac1f720) at Zend/zend_language_scanner.l:661
#16 0x00000000008a4724 in zend_include_or_eval (inc_filename=0x7f651ac1f720, type=2) at Zend/zend_execute.c:3192
#17 0x0000000000873922 in ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER (execute_data=0x7f651ac1f6c0) at Zend/zend_vm_execute.h:37667
#18 0x000000000085d658 in execute_ex (ex=0x7f651ac1f6c0) at Zend/zend_vm_execute.h:55334
#19 0x0000000000814e0c in zend_call_function (fci=<optimized out>, fci_cache=0x7ffd85ed0a10) at Zend/zend_execute_API.c:756
#20 0x0000000000716598 in zif_spl_autoload_call (execute_data=<optimized out>, return_value=<optimized out>) at ext/spl/php_spl.c:448
#21 0x0000000000814e79 in zend_call_function (fci=<optimized out>, fci_cache=0x7ffd85ed0c38) at Zend/zend_execute_API.c:770
#22 0x0000000000815602 in zend_lookup_class_ex (name=<optimized out>, key=0x0, use_autoload=<optimized out>) at Zend/zend_execute_API.c:926
#23 0x000000000083626c in zif_class_exists (execute_data=<optimized out>, return_value=0x7f651ac1f5e0) at Zend/zend_builtin_functions.c:1446
#24 0x00000000008860ea in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (execute_data=0x7f651ac1f550) at Zend/zend_vm_execute.h:690
#25 0x000000000085d658 in execute_ex (ex=0x7f651ac1f550) at Zend/zend_vm_execute.h:55334
#26 0x000000000085d7ec in zend_execute (op_array=0x7f651ac611c0, return_value=0x0) at Zend/zend_vm_execute.h:60881
#27 0x0000000000821bd7 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at Zend/zend.c:1568
#28 0x00000000007d0a03 in php_execute_script (primary_file=<optimized out>) at main/main.c:2630
#29 0x00000000008b5a5d in main (argc=<optimized out>, argv=<optimized out>) at sapi/fpm/fpm/fpm_main.c:1950


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-15 09:12 UTC] ixghzx at gmail dot com
This bug does not occur with PHP 7.4.0beta2.
But this issue is still reproducible with PHP 7.3.8.
 [2021-06-10 10:47 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-06-10 10:47 UTC] cmb@php.net
PHP-7.3 is locked for security issues only.  Do you experience
this issue with any of the actively supported PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-06-20 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 11:01:29 2024 UTC