Edit report at https://bugs.php.net/bug.php?id=79043&edit=1
ID: 79043
Comment by: benjamin dot morel at gmail dot com
Reported by: benjamin dot morel at gmail dot com
Summary: Segmentation fault when using preloading
Status: Open
Type: Bug
Package: opcache
Operating System: CentOS 7.7
PHP Version: 7.4.1
Block user comment: N
Private report: N
New Comment:
Please ignore the Fatal Error for the last command, the one that issues the warnings. This was a
copy/paste mistake. This command does output the warnings, but not the Fatal Error.
Previous Comments:
------------------------------------------------------------------------
[2020-01-07 16:19:52] benjamin dot morel at gmail dot com
Nikic,
# php -d opcache.enable_cli=1 -d opcache.preload=preload.php -r ''
Tue Jan 7 17:13:09 2020 (25255): Fatal Error "opcache.preload_user" has not been defined
I guess you were expecting me to replace preload.php with the actual path, so here you are:
# php -d opcache.enable_cli=1 -d opcache.preload=/home/username/example.com/current/preload.php -r
''
Tue Jan 7 17:13:40 2020 (25548): Fatal Error "opcache.preload_user" has not been defined
Now with preload_user:
# php -d opcache.enable_cli=1 -d opcache.preload=/home/username/example.com/current/preload.php -d
opcache.preload_user=username -r ''
Tue Jan 7 17:14:01 2020 (25800): Fatal Error "opcache.preload_user" has not been defined
Now I'm getting a lot of warnings:
PHP Warning: Declaration of Doctrine\Common\Reflection\StaticReflectionMethod::getClosure($object)
should be compatible with ReflectionMethod::getClosure($object = NULL) in
cebooks/example.com/releases/1578065246/vendor/doctrine/reflection/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php
on line 92
PHP Warning: Can't preload unlinked class
Symfony\Component\Serializer\Normalizer\PropertyNormalizer: Unknown parent
Symfony\Component\Serializer\Normalizer\AbstractObjectNo in
/home/username/example.com/releases/1578065246/vendor/symfony/serializer/Normalizer/PropertyNormalizer.php
on line 31
PHP Warning: Can't preload unlinked class
Symfony\Component\Serializer\Normalizer\ObjectNormalizer: Unknown parent
Symfony\Component\Serializer\Normalizer\AbstractObjectNormn
/home/username/example.com/releases/1578065246/vendor/symfony/serializer/Normalizer/ObjectNormalizer.php
on line 29
...
PHP Warning: Can't preload unlinked class Brick\Math\BigRational: Unknown type dependencies in
/home/username/example.com/releases/1578065246/vendor/brick/math/src/BigRatp on line 17
PHP Warning: Can't preload unlinked class Brick\Math\BigInteger: Unknown type dependencies in
/home/username/example.com/releases/1578065246/vendor/brick/math/src/BigInteon line 20
PHP Warning: Can't preload unlinked class Brick\Math\BigDecimal: Unknown type dependencies in
/home/username/example.com/releases/1578065246/vendor/brick/math/src/BigDecion line 15
But no segfault.
------------------------------------------------------------------------
[2020-01-07 16:09:32] nikic@php.net
Thanks for trying the new version! Can you please check whether you already get a crash if you do a
simple "php -d opcache.enable_cli=1 -d opcache.preload=preload.php -r ''"
running from CLI?
And yes, as preloading happens during early server startup, enabling it through php_admin_value does
not work.
------------------------------------------------------------------------
[2020-01-07 16:01:12] benjamin dot morel at gmail dot com
Same issue with PHP 7.4.2-RC1, released a few hours ago. Still SIGSEGV.
SIGSEGV only happens when I configure preloading in /etc/php.d/opcache.ini, though:
opcache.preload=/home/username/example.com/current/preload.php
opcache.preload_user=username
Everything seems to work fine if I configure it in php-fpm.d instead:
php_admin_value[opcache.preload] = /home/username/example.com/current/preload.php
php_admin_value[opcache.preload_user] = username
But even though I can see the configuration being applied (in the Configuration tab of https://github.com/rlerdorf/opcache-status), I
don't measure any performance improvement with preloading enabled.
I'm surprised as this is not in line with the benchmarks I had run a year ago:
https://github.com/composer/composer/issues/7777#issuecomment-440268416
As far as I can tell, it looks like preloading is not in effect when configured this way.
------------------------------------------------------------------------
[2019-12-30 15:13:39] bugreports at gmail dot com
bulding PHP from source is not rocket science, that below needs some adjusting for 7.4 and to build
not only the cli but should be easy to adopt
[builduser@backup-hosting:~]$ rpm -qa | grep devel | sort
glibc-devel-2.17-292.el7.x86_64
keyutils-libs-devel-1.5.8-3.el7.x86_64
krb5-devel-1.15.1-37.el7_7.2.x86_64
libcom_err-devel-1.42.9-16.el7.x86_64
libcurl-devel-7.29.0-54.el7_7.1.x86_64
libicu-devel-50.2-3.el7.x86_64
libselinux-devel-2.5-14.1.el7.x86_64
libsepol-devel-2.5-10.el7.x86_64
libstdc++-devel-4.8.5-39.el7.x86_64
libtool-ltdl-devel-2.4.2-22.el7_3.x86_64
libverto-devel-0.2.5-4.el7.x86_64
libxml2-devel-2.9.1-6.el7_2.3.x86_64
openssl-devel-1.0.2k-19.el7.x86_64
pcre-devel-8.32-17.el7.x86_64
xz-devel-5.2.2-1.el7.x86_64
zlib-devel-1.2.7-18.el7.x86_64
[builduser@backup-hosting:~]$ cat build-php-cli.sh
#!/usr/bin/bash
PHP_VERSION="7.2.15"
rm -rf /home/builduser/BUILDROOTS/php-$PHP_VERSION
tar xfJ /home/builduser/SOURCES/php-$PHP_VERSION.tar.xz -C /home/builduser/BUILDROOTS/
cd /home/builduser/BUILDROOTS/php-$PHP_VERSION
export CFLAGS="-m64 -Os -mfpmath=sse -mavx -msse2avx -march=native -mtune=native
-ftree-vectorize -fomit-frame-pointer -fno-strict-aliasing -fwrapv -g0"
export CC="gcc $CFLAGS"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="$CFLAGS"
export CXX="gcc $CFLAGS"
./configure --quiet \
--host=x86_64-redhat-linux \
--build=x86_64-redhat-linux \
--target=x86_64-redhat-linux \
--prefix=/home/builduser/BUILD \
--program-prefix= \
--disable-all \
--enable-calendar \
--enable-cli \
--enable-ctype \
--enable-dom \
--enable-filter \
--enable-hash \
--enable-intl \
--enable-json \
--enable-libxml \
--enable-mbregex \
--enable-mbstring \
--enable-posix \
--enable-simplexml \
--enable-soap \
--enable-static \
--enable-xml \
--with-curl \
--with-iconv \
--with-layout=GNU \
--with-openssl \
--with-pcre-regex \
--with-system-ciphers \
--with-zlib \
--without-apxs2 \
--without-config-file-path \
--without-config-file-scan-dir \
--without-pcre-jit \
--disable-cgi \
--disable-dmalloc \
--disable-dtrace \
--disable-gcov \
--disable-ipv6 \
--disable-phpdbg \
--disable-rpath \
--disable-shared \
--disable-short-tags
make --quiet -j4
make install
strip -s --strip-unneeded /home/builduser/BUILD/bin/php
mv --force /home/builduser/BUILD/bin/php /home/builduser/BINARIES/
rm -rf /home/builduser/BUILD/*
rm -rf /home/builduser/BUILDROOTS/php-$PHP_VERSION
chmod 755 /home/builduser/BINARIES/php
ls /home/builduser/BINARIES/php
echo ""
/home/builduser/BINARIES/php -v
echo ""
/home/builduser/BINARIES/php -m
------------------------------------------------------------------------
[2019-12-30 15:09:05] benjamin dot morel at gmail dot com
It will be hard for me right now to test against 7.4 HEAD. I will wait until 7.4.2 is released and
will report back here.
------------------------------------------------------------------------
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=79043
--
Edit this bug report at https://bugs.php.net/bug.php?id=79043&edit=1