Bug #80419 [Opn]: opcache: free memory not reported as free
Edit report at https://bugs.php.net/bug.php?id=80419&edit=1
ID: 80419
Updated by: cmb@php.net
Reported by: carsten_hammer at web dot de
Summary: opcache: free memory not reported as free
Status: Open
Type: Bug
Package: opcache
Operating System: Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Not sure what to do here. On Windows, the situation is even
worse, since one could change INI settings for future FCGI
processes in php.ini. Still, likely a documentation issue.
Previous Comments:
------------------------------------------------------------------------
[2020-11-30 14:11:58] nikic@php.net
We should probably make setting of opcache.memory_consumption (and certain other settings) fail if
opcache is already started up. That way it would at least be obvious from phpinfo output that the
value did not change.
------------------------------------------------------------------------
[2020-11-27 14:56:24] carsten_hammer at web dot de
Yep, that seems to be it.
I've been setting the opcache.memory_consumption in an external opcache.ini as well as the fpm
pool config but not in the php.ini itself.
Tried it just now, and everything is reported correctly.
So, the takeaway is: don't try to set opcache.memory_consumption outside of the php.ini.
------------------------------------------------------------------------
[2020-11-27 12:06:52] nikic@php.net
Can't reproduce this on cli at least, free memory changes as memory_consumption changes.
First guess is that opcache.memory_consumption gets set in a place that still allows setting
PHP_INI_SYSTEM settings, but after opcache has already started up and the shared memory segment has
been allocated (this would also be consistent with the negative "used memory" you see in
one case, as that is calculated from the value of opcache.memory_consumption and the free and wasted
memory).
Which mechanism do you use to set opcache.memory_consumption? Is it anything other than a
system-wide php.ini file?
------------------------------------------------------------------------
[2020-11-26 13:26:03] carsten-hammer at web dot de
Right, this is on nginx + php-fpm.
Here is the phpinfo() output:
Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
Startup OK
Shared memory model mmap
Cache hits 0
Cache misses 1
Used memory 76277336
Free memory 125049256
Wasted memory 0
Interned Strings Used memory 237144
Interned Strings Free memory 6053864
Cached scripts 1
Cached keys 1
Max keys 16229
OOM restarts 0
Hash keys restarts 0
Manual restarts 0
opcache.blacklist_filename no value
opcache.consistency_checks 0
opcache.dups_fix Off
opcache.enable On
opcache.enable_cli Off
opcache.enable_file_override Off
opcache.error_log no value
opcache.file_cache no value
opcache.file_cache_consistency_checks On
opcache.file_cache_only Off
opcache.file_update_protection 2
opcache.force_restart_timeout 180
opcache.huge_code_pages Off
opcache.interned_strings_buffer 8
opcache.lockfile_path /tmp
opcache.log_verbosity_level 1
opcache.max_accelerated_files 10000
opcache.max_file_size 0
opcache.max_wasted_percentage 5
opcache.memory_consumption 192
opcache.opt_debug_level 0
opcache.optimization_level 0x7FFEBFFF
opcache.preferred_memory_model no value
opcache.preload no value no value
opcache.preload_user no value
opcache.protect_memory Off
opcache.restrict_api no value
opcache.revalidate_freq 2
opcache.revalidate_path Off
opcache.save_comments On
opcache.use_cwd On
opcache.validate_permission Off
opcache.validate_root Off
opcache.validate_timestamps On
Local Values are exactly the same as Master Values.
------------------------------------------------------------------------
[2020-11-26 11:26:40] cmb@php.net
It could be helpful if you provide the full phpinfo() output of
the OPcache extension. Also, which SAPI do you use?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=80419
--
Edit this bug report at https://bugs.php.net/bug.php?id=80419&edit=1
Thread (10 messages)