[php-src] Issue #7817: JIT segmentation fault in PHP 8.1
| From: | kvas-damian | Date: | Tue, 08 Mar 2022 12:13:56 +0000 |
| Subject: | [php-src] Issue #7817: JIT segmentation fault in PHP 8.1 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240264@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7817
Comment Author: kvas-damian
We had a similar problem after upgrade to PHP 8.1.3 - before we used PHP 8.0.3 without problems.
In our case, Laravel8 app based on PHP-FPM is hosted in Kubernetes. K8s cluster is based on
N2D instances with 3rd Gen AMD EPYC processors. Dockerfile which started the problem
for us is following:
```
FROM composer:2.1.12 AS php-composer
FROM php:8.1.3-fpm-alpine3.15
USER root
RUN apk --no-cache add --virtual .build-deps \
build-base \
&& apk --no-cache add libpng-dev libzip-dev libjpeg-turbo-dev freetype-dev \
&& docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
&& docker-php-ext-install -j$(nproc) bcmath gd zip mysqli pdo_mysql sockets \
&& docker-php-ext-enable opcache \
&& echo $'zend_extension=opcache\n\
[opcache]\n\
opcache.enable=1\n\
opcache.enable_cli=1\n\
opcache.validate_timestamps=0\n\
opcache.max_accelerated_files=10000\n\
opcache.memory_consumption=128\n\
opcache.max_wasted_percentage=10\n\
opcache.interned_strings_buffer=16\n\
opcache.fast_shutdown=1\n\
opcache.jit_buffer_size=100M' > /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini \
&& apk del .build-deps
# copy composer from the first stage
COPY --from=php-composer /usr/bin/composer /usr/bin
RUN composer --ansi --version --no-interaction; php -v; php -m; php -r 'var_export(gd_info());
echo PHP_EOL; var_export(opcache_get_status());'
```
**From ~20 identical pods, only 2 were segfaulting, for all requests**. We found following entries
in our logs:
```
[4539894.358435] php-fpm[3056477]: segfault at 8 ip 0000000048d82054 sp 00007ffe99621df0 error 4 in
zero (deleted)[48d19000+6400000]\r\n
WARNING: [pool www] child 792 exited on signal 11 (SIGSEGV) after 15.030120 seconds from start
```
Change from JIT tracing to function (opcache.jit=1205) solved
the problem.
I hope it helps you find the root cause.