php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67691 Opcache "used memory" value wrong
Submitted: 2014-07-27 17:45 UTC Modified: 2015-03-24 08:49 UTC
Votes:12
Avg. Score:4.1 ± 0.9
Reproduced:8 of 8 (100.0%)
Same Version:8 (100.0%)
Same OS:5 (62.5%)
From: torben at dannhauer dot info Assigned: rasmus (profile)
Status: Closed Package: opcache
PHP Version: 5.6.4 OS: Linux Debian Jessie
Private report: No CVE-ID: None
 [2014-07-27 17:45 UTC] torben at dannhauer dot info
Description:
------------
For PHP-FPM settings with large memory size configurations, a large portion (70%-90%) of the opcache memory is reported as "used" even directly after restarting PHP-FPM without any php scripts cached.






Test script:
---------------
To reproduce: 

* configure your php.ini:

php_admin_value[memory_limit] = 1G
php_admin_value[upload_max_filesize] = 1G
php_admin_value[post_max_size] = 1G

; OpCache Bytecode caching
php_flag[opcache.enable] = on
php_flag[opcache.enable_cli] = on
php_admin_value[opcache.memory_consumption] = 512M
php_admin_value[opcache.max_accelerated_files] = 50000


* restart PHP-FPM
* look at opcache memrory used value.

Expected result:
----------------
At least directly after PHP restart, it should not be dependent on memory size configurations

Actual result:
--------------
phpinfo() : 

Used memory 	206827696
Free memory 	61607760 

Patches

make_saved_free_memory_counter_bigger.patch (last revision 2015-03-24 08:30 UTC by denis at shashkov dot pro)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-12 09:13 UTC] torben at dannhauer dot info
-PHP Version: 5.6.0RC2 +PHP Version: 5.6.0RC3
 [2014-08-12 09:13 UTC] torben at dannhauer dot info
This bug still exsits in 5.6 RC3
 [2014-08-25 06:05 UTC] torben at dannhauer dot info
-PHP Version: 5.6.0RC3 +PHP Version: 5.6.0RC4
 [2014-08-25 06:05 UTC] torben at dannhauer dot info
The bug is still existent in PHP 5.6 RC4
 [2014-09-08 05:23 UTC] torben at dannhauer dot info
-PHP Version: 5.6.0RC4 +PHP Version: 5.6.0
 [2014-09-08 05:23 UTC] torben at dannhauer dot info
Bug still exists in stable 5.6.0
 [2014-10-27 09:17 UTC] torben at dannhauer dot info
-PHP Version: 5.6.0 +PHP Version: 5.6.2
 [2014-10-27 09:17 UTC] torben at dannhauer dot info
The bug exists also in 5.6.2.. :(
 [2015-01-03 18:32 UTC] torben at dannhauer dot info
-PHP Version: 5.6.2 +PHP Version: 5.6.4
 [2015-01-03 18:32 UTC] torben at dannhauer dot info
Still exists in 5.6.4
 [2015-01-06 16:48 UTC] rasmus@php.net
-Status: Open +Status: Analyzed
 [2015-01-06 16:48 UTC] rasmus@php.net
I am not able to reproduce this.

I checked both php-fpm and mod_php. 
For 256M php-fpm (PHP 7) I see:

   [used_memory] => 18738768
   [free_memory] => 249696688

and for 512M mod_php (PHP 5.6-dev) I see:

   [used_memory] => 11698176
   [free_memory] => 525172736
 [2015-03-24 08:33 UTC] denis at shashkov dot pro
We have similar behaviour after restarting Opcache.
I've found a misfit in the different variables storing shared_free counter - see my patch.
 [2015-03-24 08:49 UTC] rasmus@php.net
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: rasmus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC