|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75091 The memory taken from opcache.interned_strings_buffer isn't refreshed
Submitted: 2017-08-18 10:17 UTC Modified: -
From: j3mata at gmail dot com Assigned:
Status: Open Package: opcache
PHP Version: 7.0.22 OS: CentOS 6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: j3mata at gmail dot com
New email:
PHP Version: OS:


 [2017-08-18 10:17 UTC] j3mata at gmail dot com

I have came accross this issue after we have recieved random complains for 500ISE errors, which are solved after increasing  opcache.interned_strings_buffer value.

Through series of tests, it seems that the memory set for opcache.interned_strings_buffer is filled the first time the opcache cache files are created and then if the value set for opcache.interned_strings_buffer is changed, the same amount of memory is requested as the first run. 
Clearing up the opcache file_cache restarts the above described process.

This leads to unexpected behaviour:
  * if the value is changed to smaller then the initial value -> most likely the site will not load and will return various errors. It seems the cached files are loaded from the opcache code, until the memory is filled ( set by the smaller value ) and just doesn't load the whole application.
  * if the value is changed to bigger then the initial value -> the opcache uses the same amount of memory for interned_strings_buffer as the initial run.

This is produced in this environment:
 * shared hosting, where the users applications are kept and loaded from /home/USER/
 * opcache file_cache is stored in /home/USER/.opcache
 * install a application which will take more then 3MB of the interned_strings_buffer memory. Observe with opcache_get_status() the interned_strings_buffer usage 
    ** Here I am using a default WP install, add some big plugings so it has enough modiles/classes to load and somewhere in the code to print out opcache_get_status().
 * Set interned_strings_buffer to 4MB and load the application - the interned_strings_buffer memory usage would be somewhere between 3MB and 4MB.
 * Set interned_strings_buffer to 2MB - it should break ( most often - not able to load some class or 500ISE ).

 * Clear /home/USER/.opcache/ files.
 * Set interned_strings_buffer to 2MB and again observe its usage the same way as above - it uses all 2MB ( with a few bytes left free ).
 * Set interned_strings_buffer to 16MB and again observe its usage - it uses exactly the same amount of memory as the first run ~ 2MB.

For the tests I was using opcache.memory_consumption with values 64/128/256.

Tested on PHP versions 7.0.22 and 7.1.8.

I am not sure this a bug in the opcache, but certainly doesn't seem to be expected behaviour.



Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sat Nov 18 15:03:12 2017 UTC