You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opcache.consistency_checks > 0 causes segfaults in PHP >= 8.1.5 in fpm context #8065
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.
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.
If the checksum comparison fails, the file is compiled again, and the old oparray is not freed – that is by design, to avoid copying shared memory. As such, this doesn't look like a bug, but I wonder why the checksum comparison fails in the first place. Are these files modified during script execution?
Activity
cmb69 commentedon Feb 9, 2022
Do you get any "Checksum failed for" log entries, if you set
opcache.error_log=…andopcache.log_verbosity_level=4?CyberLine commentedon Feb 9, 2022
cmb69 commentedon Feb 9, 2022
Thanks!
If the checksum comparison fails, the file is compiled again, and the old oparray is not freed – that is by design, to avoid copying shared memory. As such, this doesn't look like a bug, but I wonder why the checksum comparison fails in the first place. Are these files modified during script execution?
CyberLine commentedon Feb 9, 2022
No, they aren't. You can run the same code on PHP 7.4 or 8.0 without "Checksum failed" error 🤷
Same output with php7.4 or 8.0:
34 remaining items
Fix phpGH-8065: opcache.consistency_checks > 0 causes segfaults in PH…
Disable opcache.consistency_checks
Merge branch 'PHP-8.1' into PHP-8.2
Merge branch 'PHP-8.2'
Fix phpGH-8065: opcache.consistency_checks > 0 causes segfaults in PH…