Skip to content

opcache.consistency_checks > 0 causes segfaults in PHP >= 8.1.5 in fpm context #8065

Closed
@CyberLine

Description

@CyberLine

Description

After upgrading some projects to PHP 8.1.0 and 8.1.2 we could see requests getting slower and slower over time. Restart of the correspondig fpm-pool fixed that for short. After digging in the problem we could isolate and reproduce it:

  • use a Debian 10 or 11 maschine and install php8.1-fpm and php8.1-opcache.
  • modify opcache.ini:
zend_extension=opcache.so

[opcache]
opcache.consistency_checks=1
  • require laminas: composer require laminas/laminas-servicemanager
  • create a test script (we use laminas-servicemanager here):
<?php

declare(strict_types=1);

chdir(dirname(__DIR__));
require 'vendor/autoload.php';

use Laminas\ServiceManager\ServiceManager;
$container = new ServiceManager();
  • call that script in a loop 1000 or more times while running htop in another terminal:
    for i in {1..10000}; do curl localhost/test.php; done;

You would see an increment usage of memory that will not getting freed after all. Set opcache.consistency_checks to 0 to check that it will not keep any used memory.

PHP Version

8.1.0

Operating System

Debian 10/11

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions