Bug #78225 [Opn]: brent@spatie.be
| From: | brent at spatie dot be | Date: | Tue, 02 Jul 2019 12:48:44 +0000 |
| Subject: | Bug #78225 [Opn]: brent@spatie.be | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-221582@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78225&edit=1
ID: 78225
User updated by: brent at spatie dot be
Reported by: brent at spatie dot be
-Summary: Preloading Laravel results in a segfault
+Summary: brent@spatie.be
Status: Open
Type: Bug
Package: opcache
Operating System: macOS Mojave
PHP Version: 7.4.0alpha2
Block user comment: N
Private report: N
New Comment:
I'm not sure whether the patch about facades was a troll or not, but it gave me a debug idea.
It turns out the segfault only happens when trying to preload one of these classes:
- \Illuminate\Log\LogManager
(https://github.com/laravel/framework/blob/5.8/src/Illuminate/Log/LogManager.php)
- \Illuminate\Http\Testing\File
(https://github.com/laravel/framework/blob/5.8/src/Illuminate/Http/Testing/File.php)
- \Illuminate\Http\UploadedFile
(https://github.com/laravel/framework/blob/5.8/src/Illuminate/Http/UploadedFile.php)
- \Illuminate\Support\Carbon
(https://github.com/laravel/framework/blob/5.8/src/Illuminate/Support/Carbon.php)
I've also updated my example project: https://github.com/brendt/laravel-preload/commit/fa8e8b253ebd771f99c41554ed44b80197a23ba7
Previous Comments:
------------------------------------------------------------------------
[2019-07-02 11:57:16] facades at laravel dot com
The following patch has been added/updated:
Patch Name: did_you_try_adding_facades_prefix
Revision: 1562068636
URL: https://bugs.php.net/patch-display.php?bug=78225&patch=did_you_try_adding_facades_prefix&revision=1562068636
------------------------------------------------------------------------
[2019-07-01 08:23:39] brent at spatie dot be
I added a version using opcache_compile: https://github.com/brendt/laravel-preload/tree/opcache_compile
; it also results in a segfault.
The reason I wanted to use include or require is that it opcache_compile seemed to result in lots of
unlinked classes. My guess was this it wouldn't resolve the class dependencies since the docs
explicitly state that it won't execute the file.
------------------------------------------------------------------------
[2019-07-01 08:13:11] beberlei@php.net
All examples Dmitry showed used opcache_compile_file instead of require. Can you try that?
------------------------------------------------------------------------
[2019-06-28 16:23:50] ramsey@php.net
Is there a way to delete a patch submitted to a bug report? The submitted joke is unhelpful, rude,
and has no place in the PHP bug tracker. Take your jokes to Twitter.
------------------------------------------------------------------------
[2019-06-28 09:51:28] brent at spatie dot be
Description:
------------
I'm trying to preload Laravel. I've compiled php-7.4.0alpha2 using the following configure
command:
```
./configure \
OPENSSL_CFLAGS=-I/usr/local/opt/openssl/include \
OPENSSL_LIBS="-L/usr/local/opt/openssl -lssl -lcrypto" \
'--prefix=/Users/brent/dev/php/build/php-74-alpha2' \
'--with-config-file-path=/Users/brent/dev/php/build/php-74-alpha2/etc' \
'--with-config-file-scan-dir=/Users/brent/dev/php/build/php-74-alpha2/etc/conf.d' \
'--enable-bcmath' \
'--enable-calendar' \
'--enable-dba' \
'--enable-exif' \
'--enable-fpm' \
'--enable-mysqlnd' \
'--enable-pcntl' \
'--with-curl=/usr/local/opt/curl-openssl' \
'--with-iconv=/Library/Developer/CommandLineTools/usr' \
'--with-layout=GNU' \
'--with-mysql-sock=/tmp/mysql.sock' \
'--with-mysqli=mysqlnd' \
'--with-openssl=shared' \
'--with-openssl-dir=/usr/local/opt/openssl' \
'--with-password-argon2=/usr/local/opt/argon2' \
'--with-pdo-mysql=mysqlnd' \
'--with-pdo-sqlite=/usr/local/opt/sqlite' \
'--with-sodium=/usr/local/opt/libsodium' \
'--with-sqlite3=/usr/local/opt/sqlite' \
```
The code to try it out can be found here: https://github.com/brendt/laravel-preload
This is the preload script: https://github.com/brendt/laravel-preload/blob/master/preload.php
After all files were preloaded, php-fpm crashes with the following error:
```
[1] 61893 segmentation fault ./php-fpm --nodaemonize
```
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78225&edit=1