[php-src] Issue #8065: opcache.consistency_checks > 0 is leaking memory in PHP >= 8.1.0 in fpm context
| From: | CyberLine | Date: | Wed, 09 Feb 2022 09:25:02 +0000 |
| Subject: | [php-src] Issue #8065: opcache.consistency_checks > 0 is leaking memory in PHP >= 8.1.0 in fpm context | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239568@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8065
Author: 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
```
- 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