Doc #81365 [Opn->Csd]: Flipping opcache.file_cache_only is broken

[email protected]
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=81365&edit=1

 ID:                 81365
 Updated by:         [email protected]
 Reported by:        wedwards at cyberfusion dot nl
 Summary:            Flipping opcache.file_cache_only is broken
-Status:             Open
+Status:             Closed
 Type:               Documentation Problem
 Package:            opcache
 Operating System:   Debian 10
 PHP Version:        7.4.22
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2021-08-18 09:33:15] [email protected]

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-08-17 14:31:08] 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-17 13:23:17] [email protected]

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-16 15:23:44] 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



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81365&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.