Skip to content

JIT fault #11127

Closed
ThePHPF/thephp.foundation
#90
@EvgenijKrupchenko

Description

@EvgenijKrupchenko

Description

This bug was accidentally noticed in complex production scripts and was very hard to manually reproduce in a simple example. But nevermind, here's a working example below.
I use two files:

1.php:

<?
include('2.php');
for($a=1;$a<100;$a++){
        echo _f('1');
        echo _f('1');
        echo _f('1');
}
?>

2.php:

<?
define('C','1');
function _f($u){
        return $u==C?'0':'1';
}
?>

In short: the script is using multiple times a function, that is located in another php script file.
Under php 8.2, 8.1 and 8.0 - same results.
Under php-fpm and under apache/mod_php - same result.
Under php-cli - bug not reproducible

Steps to do:

  1. Restart the backend (php-fpm or apache/mod_php)
  2. Open in browser 1.php - works fine
  3. Make any changes to 2.php or simply run "touch 2.php" to only modify the time of that file
  4. Refresh the page with 1.php - Nginx (frontend) says "502 Bad Gateway" with log:
    upstream prematurely closed connection while reading response header from upstream

Apache error log empty.
Php-fpm error log says something like:
[24-Apr-2023 18:21:07] WARNING: [pool u10] child 71477 exited on signal 11 (SIGSEGV) after 20.735545 seconds from start
[24-Apr-2023 18:21:07] NOTICE: [pool u10] child 71484 started

php.ini:
opcache.jit_buffer_size=128M

When only i add:
opcache.jit=1205
The bug disappear, but php performance become a bit slower.

And also setting opcache.jit_buffer_size=0 solves the bug as well as slowing down the performance of course.

I have no clue what's going on, but something is clearly becomes wrong causing the executing process to crash.

PHP Version

php 8.2.5 8.1.18 8.0.28

Operating System

Debian 11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions