Bug #80419 [Opn]: opcache: free memory not reported as free

From: Date: Fri, 27 Nov 2020 12:06:52 +0000
Subject: Bug #80419 [Opn]: opcache: free memory not reported as free
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230683@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80419&edit=1 ID: 80419 Updated by: nikic@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: 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? Previous Comments: ------------------------------------------------------------------------ [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? ------------------------------------------------------------------------ [2020-11-25 16:34:13] carsten_hammer at web dot de Description: ------------ It's either buggy output in phpinfo() or an actual bug in opcache, not quite sure which. Set opcache.memory_consumption to anything other than 128 to see the effect: memory_consumption at 64 = used memory: -57940392, free memory: 125049256 memory_consumption at 128 = used memory: 9168472, free memory: 125049256 memory_consumption at 192 = used memory: 76277336, free memory: 125049256 memory_consumption at 256 = used memory: 143386200, free memory: 125049256 Free memory never goes above 125049256, no matter what. Seen with version 7.3.20 and 7.4.6 on CentOS, 7.4.12 on Fedora as well as 7.4.13 on Arch Linux. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80419&edit=1

« previous php.bugs (#230683) next »