php.net |  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: 2017-12-28 11:17 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: j3mata at gmail dot com
New email:
PHP Version: OS:

 

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

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.

Regards,
Ilian.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-20 07:44 UTC] kimegede at gmail dot com
Running PHP 7.0.25 (+ Zend OPcache v7.0.25) on Centos 7.4.1708
Haven't yet figured out what the issue is, but with OPCache enabled, the applications will crash, leading to "500 Internal Server Error".
Earlier on, I got Segfaults:

Nov  2 11:32:21 ip-172-31-27-62 kernel: php-fpm[21952]: segfault at 2f2a2020 ip 00007feb149f6faf sp 00007ffe8a547c68 error 4
Nov  2 11:32:21 ip-172-31-27-62 kernel: php-fpm[22276]: segfault at 2f2a2020 ip 00007feb149f6faf sp 00007ffe8a547c68 error 4
Nov  2 11:32:21 ip-172-31-27-62 kernel: in libc-2.17.so[7feb148ba000+1b8000]
Nov  2 11:09:04 ip-172-31-27-62 kernel: traps: php-fpm[123783] general protection ip:7feb176433b1 sp:7ffe8a548cc0 error:0 in php-fpm[7feb173e1000+3e8000]
Nov  2 11:09:04 ip-172-31-27-62 kernel: php-fpm[123430]: segfault at 2f2a2020 ip 00007feb149f6faf sp 00007ffe8a547c68 error 4 in libc-2.17.so[7feb148ba000+1b8000]
Nov  2 11:09:04 ip-172-31-27-62 kernel: traps: php-fpm[117106] general protection ip:7feb149f6faf sp:7ffe8a547e98 error:0 in libc-2.17.so[7feb148ba000+1b8000]
 [2017-12-28 11:17 UTC] nikic@php.net
The issue where reducing the interned string buffer after file cache initialization causes corruption/crashes has been fixed in bug #75579.

The issue that strings are not interned if they couldn't be interned when the file cache was initialized still exists.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC