Edit report at https://bugs.php.net/bug.php?id=75579&edit=1
ID: 75579
Updated by: nikic@php.net
Reported by: post at minhost dot no
Summary: All Interned Strings Free memory used and PHP
crashes
Status: Open
Type: Bug
Package: opcache
Operating System: CentOS 7.4
PHP Version: 7.1.12
Block user comment: N
Private report: N
New Comment:
PHP definitely shouldn't crash just because the interned string buffer runs full. The only
recent change to interning in 7.0 I see is https://github.com/php/php-src/commit/d82805f097564558d94e3062e87b17d6ccae893f,
which does not look problematic to me.
It might be that this is a round-about side-effect of bug #75573, which is a memory corruption issue
that also seems to affect some WP plugins.
Previous Comments:
------------------------------------------------------------------------
[2017-11-29 11:07:29] post at minhost dot no
@spam2 at rhsoft dot net: You are wrong about this. I have allocated enough memory to opcache (32
GB). I am talking about "opcache.interned_strings_buffer", it should not crash PHP sites
when it is to low. And in PHP 7.1.11 it does not. Suddenly in PHP 7.1.12 it uses all "Interned
Strings Free memory" and sites start to go down.
I just now was able to reproduce this in a test VPS server wich only contain a few test sites. This
is what I did:
I was using this value wich is default: opcache.interned_strings_buffer=4
Then I installed 8 vanilla WordPress sites, and visited them all. After that it looked like this in
PHP info page:
Interned Strings Used memory 2094032
Interned Strings Free memory 2100272
Then on ONE of the WordPress sites I installed the following plugins:
All In One SEO Pack
Contact Form 7
Jetpack by WordPress.com
MetaSlider
TinyMCE Advanced
WooCommerce
Wordfence Security
Then it looked like this in PHP info page:
Interned Strings Used memory 4194288
Interned Strings Free memory 16
As you can see all interned strings free memory was suddenly used, if this would have been on PHP
7.1.11 that would NOT happen. And at this point sites start to stop working. Suddenly I can't
log into wordpress admin area on some of the sites, they only give "HTTP ERROR 500", and
apache error log give this:
[Wed Nov 29 11:53:08.623533 2017] [proxy_fcgi:error] [pid 10182:tid 139804087817984] [client
176.74.214.18:32283] AH01071: Got error 'PHP message: PHP Fatal error: require_once(): Failed
opening required '\x02' (include_path='.:/usr/local/php71/lib/php') in...
However on this test there was no errors in /usr/local/php71/var/log/php-fpm.log
So I am able to duplicate this on a test VPS server without any clients, only by installing a few
WordPress sites and som extra plugins in one of them.
------------------------------------------------------------------------
[2017-11-29 10:54:24] spam2 at rhsoft dot net
it helps you in the way that your server no longer crashs and you can assume that with 7.2/7.3 you
will need higher values - most of the performance improvements happen in the opcache area
it depends heavily on the numer of scripts called due runtime how high that values need to be - on
our mainserver with 8000 scripts avg cached anything below 256/8 don't work proper at all and
when you edit a file it's opcached version won't be reused at all because of "OPCache
allocates one segment of shared memory when PHP starts, once for all, and never frees it nor
fragments it" which is a design decision in favour of performance
https://git.php.net/?p=php-src.git&a=search&h=HEAD&st=commit&s=interned
------------------------------------------------------------------------
[2017-11-29 10:47:27] post at minhost dot no
@spam2 at rhsoft dot net: And how does that information help me? All I know is that on both my
production servers, when upgrading from PHP 7.1.11 to 7.1.12, on both servers PHP sites start
crashing. When downgrading to PHP 7.1.11, everything works fine again. As sait previous, I suspect
that opcache.interned_strings_buffer is the cause (but it might be something else), because on PHP
7.1.12 Interned Strings Free memory is all used up with nothing left like this:
Interned Strings Used memory 4194288
Interned Strings Free memory 16
But when I downgrade to PHP 7.1.11, there is always plenty Interned Strings Free memory left (and
PHP sites works without going down). But the only thing I know for sure, is that there is a change
in PHP 7.1.12 that cause PHP sites to go down.
------------------------------------------------------------------------
[2017-11-29 10:40:31] spam2 at rhsoft dot net
opcache.memory_consumption=64
opcache.interned_strings_buffer=8
http://blog.jpauli.tech/2015/03/05/opcache.html
OPCache allocates one segment of shared memory when PHP starts, once for all, and never frees it nor
fragments it
------------------------------------------------------------------------
[2017-11-29 10:31:34] post at minhost dot no
Still waiting hoping someone could look into this. Currently I am not able to upgrade from PHP
7.1.11 because of this, as it causes all PHP sites to go down. Also when looking at the changelog
for PHP 7.1.12 http://www.php.net/ChangeLog-7.php#7.1.12 it
has this bugfix for opcache: "Fixed bug #75373 (Warning Internal error: wrong size
calculation)." However the bug was reported for PHP 7.2.x, so maybe it does not apply to PHP
7.1.x? Could it be this fix that cause the new bug I experience?: https://bugs.php.net/bug.php?id=75373
------------------------------------------------------------------------
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=75579
--
Edit this bug report at https://bugs.php.net/bug.php?id=75579&edit=1