From: dotbox at gmail dot com
Operating system: Debian Buster
PHP version: 7.4.2RC1
Package: opcache
Bug Type: Bug
Bug description:SIGABRT double free or corruption with preloading
Description:
------------
I tried to play with preloading in OXID eShop and PHP 7.4, but Apache
dies with "double free or corruption (!prev)", so i build a debugging
enabled version of PHP and used the PHP built in web server, same
problem.
Same problem appears in PHP 7.4.1, as well es 7.4.2RC1 (did not try
7.4.0).
We have a view dependencies, but it doesn't matter if you install those
or not, PHP will die with the exact same stack trace and error whether
the dependencies have been installed or not. So for the sake of
simplicity, it could strip it down to a few steps.
Could be related to https://bugs.php.net/bug.php?id=78894
Test script:
---------------
- git clone git@github.com:OXID-eSales/oxideshop_ce.git
- add a preload.php (see below) to source/preload.php
- php -S localhost:8000 -t oxideshop_ce/source/ -d
opcache.preload=oxideshop_ce/source/preload.php
- in another terminal: curl localhost:8000
Server dies with:
[Thu Jan 16 14:14:35 2020] PHP 7.4.2RC1 Development Server
(http://localhost:8000) started
[Thu Jan 16 14:14:44 2020] 127.0.0.1:47674 Accepted
double free or corruption (!prev)
Aborted (core dumped)
contents of preload.php
<?php
$files= [];
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Contract/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/vendor/composer/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/vendor/composer/*/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Autoload/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Controller/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Contract/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Dao/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/DataObject/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Edition/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Service/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Routing/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Model/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/Module/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Application/Controller/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Application/Model/*.php'));
$files = array_merge($files,
glob('/var/www/oxideshop/source/Core/*.php'));
foreach ($files as $file) {
echo $file, PHP_EOL;
opcache_compile_file($file);
}
Expected result:
----------------
- Built in webserver should not crash
- client should (in this case) see a error message about missing
vendor/autoload.php ;-)
Actual result:
--------------
Program received signal SIGABRT, Aborted.
0x00007f3f6acb27bb in raise () from
target:/lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007f3f6acb27bb in raise () from
target:/lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f3f6ac9d535 in abort () from
target:/lib/x86_64-linux-gnu/libc.so.6
#2 0x00007f3f6acf4508 in ?? () from
target:/lib/x86_64-linux-gnu/libc.so.6
#3 0x00007f3f6acfac1a in ?? () from
target:/lib/x86_64-linux-gnu/libc.so.6
#4 0x00007f3f6acfc73c in ?? () from
target:/lib/x86_64-linux-gnu/libc.so.6
#5 0x00007f3f69f14bc4 in zend_hash_do_resize (ht=0x55665071d310) at
/usr/src/php/Zend/zend_hash.c:1164
#6 0x00007f3f69f137a9 in _zend_hash_add_or_update_i (ht=0x55665071d310,
key=0x7f3f65e85600, pData=0x7ffd8559ec90, flag=2) at
/usr/src/php/Zend/zend_hash.c:772
#7 0x00007f3f69f13d2e in zend_hash_add (ht=0x55665071d310,
key=0x7f3f65e85600, pData=0x7ffd8559ec90) at
/usr/src/php/Zend/zend_hash.c:874
#8 0x00007f3f69ec4f8e in zend_hash_add_ptr (ht=0x55665071d310,
key=0x7f3f65e85600, pData=0x7f3f65e02100) at Zend/zend_hash.h:591
#9 0x00007f3f69ed8322 in zend_compile_class_decl (ast=0x7f3f65e795c8,
toplevel=1 '\001') at /usr/src/php/Zend/zend_compile.c:6523
#10 0x00007f3f69ede15a in zend_compile_top_stmt (ast=0x7f3f65e795c8) at
/usr/src/php/Zend/zend_compile.c:8429
#11 0x00007f3f69ede0c9 in zend_compile_top_stmt (ast=0x7f3f65e7b6c0) at
/usr/src/php/Zend/zend_compile.c:8418
#12 0x00007f3f69e9d22d in zend_compile (type=2) at
Zend/zend_language_scanner.l:614
#13 0x00007f3f69e9d3cc in compile_file (file_handle=0x7ffd8559f480,
type=8) at Zend/zend_language_scanner.l:650
#14 0x00007f3f69c52832 in phar_compile_file (file_handle=0x7ffd8559f480,
type=8) at /usr/src/php/ext/phar/phar.c:3299
#15 0x00007f3f65d2e419 in opcache_compile_file
(file_handle=0x7ffd8559f480, type=8, key=0x7f3f65e59a98
"/var/www/oxideshop/source/bootstrap.php", op_array_p=0x7ffd8559f318)
at /usr/src/php/ext/opcache/ZendAccelerator.c:1754
#16 0x00007f3f65d2f888 in persistent_compile_file
(file_handle=0x7ffd8559f480, type=8) at
/usr/src/php/ext/opcache/ZendAccelerator.c:2127
#17 0x00007f3f6602659c in xdebug_compile_file
(file_handle=0x7ffd8559f480, type=8) at
/tmp/pear/temp/xdebug/src/base/base.c:147
#18 0x00007f3f69f6e31a in zend_include_or_eval
(inc_filename=0x7f3f65e13080, type=16) at
/usr/src/php/Zend/zend_execute.c:4214
#19 0x00007f3f69f89dfc in ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HANDLER () at
/usr/src/php/Zend/zend_vm_execute.h:13655
#20 0x00007f3f69f757a7 in ZEND_USER_OPCODE_SPEC_HANDLER () at
/usr/src/php/Zend/zend_vm_execute.h:2647
#21 0x00007f3f69fd74ab in execute_ex (ex=0x7f3f65e13020) at
/usr/src/php/Zend/zend_vm_execute.h:53893
#22 0x00007f3f66026ed1 in xdebug_execute_ex
(execute_data=0x7f3f65e13020) at
/tmp/pear/temp/xdebug/src/base/base.c:384
#23 0x00007f3f69fdb45e in zend_execute (op_array=0x7f3f65e6d000,
return_value=0x0) at /usr/src/php/Zend/zend_vm_execute.h:57913
#24 0x00007f3f69efe7be in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/src/php/Zend/zend.c:1665
#25 0x00007f3f69e607a1 in php_execute_script
(primary_file=0x7ffd855a1ba0) at /usr/src/php/main/main.c:2617
#26 0x00007f3f69fde14c in php_handler (r=0x7f3f66bc70a0) at
/usr/src/php/sapi/apache2handler/sapi_apache2.c:700
#27 0x0000556650567a40 in ap_run_handler ()
#28 0x0000556650567fd6 in ap_invoke_handler ()
#29 0x0000556650580453 in ap_process_async_request ()
#30 0x00005566505805be in ap_process_request ()
#31 0x000055665057c82d in ?? ()
#32 0x00005566505718b0 in ap_run_process_connection ()
#33 0x00007f3f6a9123df in ?? () from
target:/usr/lib/apache2/modules/mod_mpm_prefork.so
#34 0x00007f3f6a9126d4 in ?? () from
target:/usr/lib/apache2/modules/mod_mpm_prefork.so
#35 0x00007f3f6a91272f in ?? () from
target:/usr/lib/apache2/modules/mod_mpm_prefork.so
#36 0x00007f3f6a9132f3 in ?? () from
target:/usr/lib/apache2/modules/mod_mpm_prefork.so
#37 0x000055665054a67e in ap_run_mpm ()
#38 0x0000556650542f57 in main ()
--
Edit bug report at https://bugs.php.net/bug.php?id=79128&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79128&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79128&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79128&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79128&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79128&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79128&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79128&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79128&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79128&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79128&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79128&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79128&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79128&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79128&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79128&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79128&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79128&r=mysqlcfg