Closed
Description
Description
Dear PHP Maintainers,
The following code, a barebones reproduction is available at https://github.com/michdingpayc/preload-segfault-minimum-reproduction
The problematic preloaded file:
class Root1_Constant_Referencer extends Root2_Empty_Empty
// Removing the extends clause will cause preloading to succeed
// Changing the extends clause to Root1_Constant_Empty will cause preloading to succeed
// Changing the extends clause to a non-existent class will continue causing preloading to segfault
{
protected $propertyReferencingAnExternalConstant = Root1_Constant_Definer::CONSTANT;
// Removing this line will cause preloading to succeed
// Changing this to a hardcoded value will cause preloading to succeed
}
preload.php:
echo "Preload started." . PHP_EOL;
$files = require __DIR__ . '/vendor/composer/autoload_classmap.php';
foreach ($files as $file) {
@opcache_compile_file($file);
}
echo "Finished preloading" . PHP_EOL;
Resulted in this output:
$ docker-compose up
Recreating preload-segfault-minimum-reproduction_webpreloader_1 ...
Recreating preload-segfault-minimum-reproduction_webpreloader_1 ... done
Attaching to preload-segfault-minimum-reproduction_webpreloader_1
webpreloader_1 | Preload started.
webpreloader_1 | Finished preloading
preload-segfault-minimum-reproduction_webpreloader_1 exited with code 139
But I expected this output instead:
(No segmentation Fault. The following output occurs if you comment out the opcache_compile_file
call in preload.php)
$ docker-compose up
Starting preload-segfault-minimum-reproduction_webpreloader_1 ...
Starting preload-segfault-minimum-reproduction_webpreloader_1 ... done
Attaching to preload-segfault-minimum-reproduction_webpreloader_1
webpreloader_1 | Preload started.
webpreloader_1 | Finished preloading
webpreloader_1 | Thu Nov 17 18:15:38 2022 (1): Message Cached script '$PRELOAD$'
webpreloader_1 | Thu Nov 17 18:15:38 2022 (1): Message Cached script '/var/www/html/lib/preload.php'
webpreloader_1 | Thu Nov 17 18:15:38 2022 (1): Message Cached script '/var/www/html/lib/vendor/composer/autoload_classmap.php'
Recommendations attempted: (in all cases the result is the same)
- Changing base docker image from
php:8.1.1-fpm-alpine3.15
tophp:8.1.12-fpm-alpine3.15
andphp:8.2-rc-fpm-alpine3.15
. - Different settings for
opcache.jit
directive:disable
,0
,0000
,0205
,1205
. - Setting
opcache.jit_buffer_size
directive to0
.
Similar to #7817 though narrower in scope.
Running the docker-compose command in the linked repository will consistently reproduce the issue. This is a blocker for our PHP 8.1 migration. Will you please assist?
PHP Version
PHP 8.1.1 8.1.12 8.2
Operating System
Docker php:8.1.1-fpm-alpine3.15