Bug #78918 [Com]: Segfault with preloading Laravel
| From: | fosron at gmail dot com | Date: | Tue, 10 Dec 2019 10:40:10 +0000 |
| Subject: | Bug #78918 [Com]: Segfault with preloading Laravel | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224182@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78918&edit=1
ID: 78918
Comment by: fosron at gmail dot com
Reported by: brent at spatie dot be
Summary: Segfault with preloading Laravel
Status: Verified
Type: Bug
Package: opcache
Operating System: macOS 10.14
PHP Version: 7.4.0
Block user comment: N
Private report: N
New Comment:
I've tested preloading Laravel too, and i'm getting "zend_mm_heap corrupted"
with this script (https://github.com/brendt/laravel-preload/blob/master/preload.php) on a Docker
container (both require and opcache_compile_file options don't work).
Previous Comments:
------------------------------------------------------------------------
[2019-12-09 17:05:09] themohamedsaid at gmail dot com
Unfortunately I keep getting a segfault even when switching to opcache_compile_file() and restarting
php-fpm.
Wish I had more input to provide
------------------------------------------------------------------------
[2019-12-09 14:03:13] nikic@php.net
We've found some fundamental design problems in the preloading functionality today ...
The tl;dr is that you need to use opcache_compile_file() based preloading for now. Preloading based
on require calls has a whole series of issues that may result in crashes.
------------------------------------------------------------------------
[2019-12-09 13:43:35] themohamedsaid at gmail dot com
After disabling all aliases and making sure class_alias is not used, I still get a segfault.
WARNING: [pool www] child 18450 exited on signal 11 (SIGSEGV - core dumped) after 1.191760 seconds
from start
------------------------------------------------------------------------
[2019-12-09 09:08:49] nikic@php.net
Okay, that one's easy to repro:
<?php
class A {}
class_alias(A::class, 'B');
This results in the class being in the class table twice, and we don't take that into account.
------------------------------------------------------------------------
[2019-12-09 09:00:18] nikic@php.net
At the least there is an assertion failure during initial preloading:
php: /home/nikic/php-7.4/Zend/zend_hash.c:1019: _zend_hash_index_add_or_update_i: Assertion `(flag
& (1<<3)) == 0' failed.
Aborted
#4 0x0000555555d9aaad in _zend_hash_index_add_or_update_i (ht=0x7fffeab4cd50
<accel_globals+368>,
h=17592143058440, pData=0x7fffffffcf30, flag=10) at /home/nikic/php-7.4/Zend/zend_hash.c:1019
#5 0x0000555555d9ad77 in zend_hash_index_add_new (ht=0x7fffeab4cd50 <accel_globals+368>,
h=17592143058440, pData=0x7fffffffcf30) at /home/nikic/php-7.4/Zend/zend_hash.c:1068
#6 0x00007fffea8acfff in zend_hash_index_add_new_ptr (ht=0x7fffeab4cd50 <accel_globals+368>,
h=17592143058440, pData=0x7fffe360fbe8) at /home/nikic/php-7.4/Zend/zend_hash.h:746
#7 0x00007fffea8ade22 in _zend_shared_memdup (source=0x7fffeb80b040, size=456, arena=0
'\000',
get_xlat=0 '\000', set_xlat=1 '\001', free_source=0 '\000')
at /home/nikic/php-7.4/ext/opcache/zend_shared_alloc.c:387
#8 0x00007fffea8adf67 in zend_shared_memdup_put (source=0x7fffeb80b040, size=456)
at /home/nikic/php-7.4/ext/opcache/zend_shared_alloc.c:417
#9 0x00007fffea8958d6 in zend_persist_class_entry (zv=0x7fffe3132de0)
at /home/nikic/php-7.4/ext/opcache/zend_persist.c:708
#10 0x00007fffea898de1 in zend_accel_persist_class_table (class_table=0x7fffe312f4a0)
at /home/nikic/php-7.4/ext/opcache/zend_persist.c:1032
#11 0x00007fffea8990f9 in zend_accel_script_persist (script=0x7fffe312f380, key=0x0, key_length=0,
for_shm=1) at /home/nikic/php-7.4/ext/opcache/zend_persist.c:1074
#12 0x00007fffea88b3cf in preload_script_in_shared_memory (new_persistent_script=0x7fffe2487a00)
at /home/nikic/php-7.4/ext/opcache/ZendAccelerator.c:4092
#13 0x00007fffea88c986 in accel_preload (config=0x555556bdebe8 "preload.php")
at /home/nikic/php-7.4/ext/opcache/ZendAccelerator.c:4413
#14 0x00007fffea88d334 in accel_finish_startup ()
at /home/nikic/php-7.4/ext/opcache/ZendAccelerator.c:4644
#15 0x00007fffea887c6b in accel_post_startup ()
at /home/nikic/php-7.4/ext/opcache/ZendAccelerator.c:3024
#16 0x0000555555d830ec in zend_post_startup () at /home/nikic/php-7.4/Zend/zend.c:1000
------------------------------------------------------------------------
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=78918
--
Edit this bug report at https://bugs.php.net/bug.php?id=78918&edit=1