php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81365 Flipping opcache.file_cache_only is broken
Submitted: 2021-08-16 15:23 UTC Modified: 2021-09-06 11:07 UTC
From: wedwards at cyberfusion dot nl Assigned:
Status: Closed Package: opcache
PHP Version: 7.4.22 OS: Debian 10
Private report: No CVE-ID: None
 [2021-08-16 15:23 UTC] wedwards at cyberfusion dot nl
Description:
------------
I recently disabled opcache.file_cache_only (default). opcache.file_cache is set, however. This caused the issue below on 1 out of estimated 100 websites.

When using OPcache with SHM Cache *or* File Cache, OPcache works as expected.

When using OPcache with SHM Cache *and* File Cache, memory is exhausted:

"Allowed memory size of 268435456 bytes exhausted (tried to allocate 70064798980 bytes)"

... followed by PHP-FPM logging the process ended with SIGSEGV.

I 'fixed' this issue by physically removing the OPcache directory tree. This leads me to believe the issue is with the size of this website's OPcache, which is 87 MiB (the second largest one is 69 MiB). I expect this issue to reoccur as the OPcache grows.
 
I found one other report of this behaviour (see last lines): https://github.com/Yoast/wordpress-seo/issues/6334#issuecomment-269647620


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-17 13:23 UTC] nikic@php.net
Looks like some kind of memory corruption is occurring in shm+file_cache mode. The memory exhaustion error is (likely) just the way it manifests.

I won't be able to diagnose this without some way to reproduce the issue though.
 [2021-08-17 14:31 UTC] wedwards at cyberfusion dot nl
This seems to be related: https://bugs.php.net/bug.php?id=80864 , the difference being that I'm only seeing this issue with opcache.file_cache_only disabled.

> Looks like some kind of memory corruption is occurring in shm+file_cache mode. 
> The memory exhaustion error is (likely) just the way it manifests.
> 
> I won't be able to diagnose this without some way to reproduce the issue 
> though.

I guess reproducing it should be easy when using PHP 7.4:

1. Enable opcache.file_cache and opcache.file_cache_only
2. Let the OPcache on disk grow (I've seen this issue with OPcache dirs around 120 MiB)
3. Disable opcache.file_cache_only
 [2021-08-18 09:33 UTC] nikic@php.net
We haven't been testing this kind of file_cache_only config switch until now.

For the file_cache_only=0 -> file_cache_only=1 direction, I found one minor issue, currently testing at https://github.com/php/php-src/pull/7384.

For the file_cache_only=1 -> file_cache_only=0 direction, current master is clean, but there are major problems for earlier versions. For now, I can only recommend to clear the file cache if you flip the file_cache_only setting.
 [2021-09-06 11:07 UTC] cmb@php.net
-Summary: Using OPcache with SHM and file causes 'Allowed memory size of ... bytes exhau' +Summary: Flipping opcache.file_cache_only is broken -Type: Bug +Type: Documentation Problem
 [2021-09-06 12:46 UTC] git@php.net
Automatic comment on behalf of cmb69 (author) and web-flow (committer)
Revision: https://github.com/php/doc-en/commit/66459d593bdaf75022736d12506820da364296bf
Log: Fix #81365: Flipping opcache.file_cache_only is broken
 [2021-09-06 12:46 UTC] git@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC