Bug #75579 [Com]: All Interned Strings Free memory used and PHP crashes
| From: | post at minhost dot no | Date: | Thu, 21 Dec 2017 09:16:24 +0000 |
| Subject: | Bug #75579 [Com]: All Interned Strings Free memory used and PHP crashes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213197@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75579&edit=1
ID: 75579
Comment by: post at minhost dot no
Reported by: post at minhost dot no
Summary: All Interned Strings Free memory used and PHP
crashes
Status: Analyzed
Type: Bug
Package: opcache
Operating System: CentOS 7.4
PHP Version: 7.1.12
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
@dmitry: Thanks for the patch for PHP 7.1, however your patch: https://gist.github.com/dstogov/c84a2579600db45282e49cbd4624f7a0
looks identical to the patch @nikic created at https://gist.github.com/nikic/31e8e4510a0ed84cea543b50d78ae431
- it was already @nikic patch I tested. So there is now new change in your patch for PHP 7.1
At the moment I am not 100% sure that previous behaviour of PHP 7.1.11 was to cache all files in
disk even when there was no opcache memory left. So I will test it in PHP 7.1.11 now to see if it is
a new bug with the patch or not. I will let you know.
Previous Comments:
------------------------------------------------------------------------
[2017-12-21 08:46:26] dmitry@php.net
OOM shouldn't necessary lead to "restart". Only in case of "wasted" memory.
Otherwise you would fill and trash SHM continuously.
Anyway, thanks for perseverance and try the next version of the patch
https://gist.github.com/dstogov/c84a2579600db45282e49cbd4624f7a0
(it's for PHP-7.1)
------------------------------------------------------------------------
[2017-12-20 19:07:37] post at minhost dot no
I have tested now by using the patch from @nikic: https://gist.github.com/nikic/31e8e4510a0ed84cea543b50d78ae431
- I used the patch on PHP 7.1.13 RC1
PHP no longer crashes, so that problem seem to be solved. However there is a new problem with
physical file cache when using this patch. Previous all PHP files would be physical cached in
/home/USERNAME/.opcache/ - but after applying the patch, it seems PHP files is only physical cached
up to the point when there is not enough free memory in opcache left.
On test server I have this in PHP info page when physical of new PHP files stop to cache new files:
Used memory 129591600
Free memory 592
Also so far there seem to be now more OOM restarts when there is not enough free memory. It just
does not empty the cache anymore it seems.
Back to the new problem with physical. On the test server I have 9 wordpress sites. After applying
the patch, I started visiting one after the other, including logging into wordpress control panel on
each of them. Wordpress site 1 to 4 was cached in physical file cache, then after visiting the rest
of the wordpress sites, none of them would be cached in physical opcache.
So, please enable both normal opcache in memory and physical file cache, then visit enough sites to
use almost all opcache memory, then opcache no longer restart and free up the memory, and also new
PHP pages you visit will no longer be cached in physical file cache.
So this patch solved PHP crashes, but create new bugs.
------------------------------------------------------------------------
[2017-12-20 17:44:16] post at minhost dot no
@nikic: Yes I copied the entire patch from here: https://github.com/php/php-src/commit/ce4fb228e033ef896517aea3d01eb8d9ac055366
and replaced it in 7.1.rc1 at ext/opcache/zend_file_cache.c
Thank you for helping. I will try again with the variant you created for me at https://gist.github.com/nikic/31e8e4510a0ed84cea543b50d78ae431
------------------------------------------------------------------------
[2017-12-20 17:38:27] spam2 at rhsoft dot net
are you aware that you can download tarballs up to a specfici commit at every point in time?
https://git.php.net/?p=php-src.git;a=shortlog;h=refs/heads/PHP-7.1
------------------------------------------------------------------------
[2017-12-20 17:38:00] nikic@php.net
@post at minhost dot no: How did you apply the patch? It looks to me like you copy&pasted the
entire file from the master branch maybe?
Here's a variant of the patch that should work on 7.1: https://gist.github.com/nikic/31e8e4510a0ed84cea543b50d78ae431
It can be applied using "git apply" or "patch".
------------------------------------------------------------------------
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