Bug #75579 [Opn->Ana]: All Interned Strings Free memory used and PHP crashes

From: Date: Sun, 17 Dec 2017 21:11:47 +0000
Subject: Bug #75579 [Opn->Ana]: All Interned Strings Free memory used and PHP crashes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213151@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
 Updated by:         nikic@php.net
 Reported by:        post at minhost dot no
 Summary:            All Interned Strings Free memory used and PHP
                     crashes
-Status:             Open
+Status:             Analyzed
 Type:               Bug
 Package:            opcache
 Operating System:   CentOS 7.4
 PHP Version:        7.1.12
 Block user comment: N
 Private report:     N

 New Comment:

The issue (presumably) is https://github.com/php/php-src/blob/master/ext/opcache/zend_file_cache.c#L229.
If the script in the file cache uses an interned string, the string is not already in the interned
string buffer, and the interned string buffer has run full, this simply directly returns the string
from the string segment of the cached script. However, the string segment will be freed in https://github.com/php/php-src/blob/master/ext/opcache/zend_file_cache.c#L1467.

The reason why you are only seeing this issue now is due to https://github.com/php/php-src/commit/d82805f097564558d94e3062e87b17d6ccae893f
and the fact that you use revalidate_path=1. Prior to this fix, if revalidate_path=1 opcache
accidentally did not use the interned string buffer for most things, which is why the file cache
also did not contain interned strings.


Previous Comments:
------------------------------------------------------------------------
[2017-12-15 20:46:48] post at minhost dot no

Finnaly I made some progress: When I deactivate/remove opcache.file_cache= in my settings and only
use opcache in memory, then PHP no longer crashes! So the bug is only visible if you use physical
file cache in opcache in addition to opcache in memory. I was using file cache as a second level
fallback cache (useful when opcache get empty during restarts etc).

Now that I have pinpointed the bug to be when you have enabled both normal opcache and physical file
cache, can someone investigate this bug? Please? I have already posted the complete opcache settings
above in this bug report.

------------------------------------------------------------------------
[2017-12-15 19:50:16] post at minhost dot no

I just now today installed the latest 7.1 development branch from here https://github.com/php/php-src/branches and
tested it. I am sorry to see the problem is still not solved with any of the patches that have been
made so far. PHP still crashes for me after visiting a few WordPress sites. This time it seemed to
happen right after opcache got a automatic OOM restart.

------------------------------------------------------------------------
[2017-12-05 10:44:01] post at minhost dot no

Related To: Bug #75621

------------------------------------------------------------------------
[2017-12-05 10:12:33] pascal dot nobus at webservice dot be

Related To: Bug #75621

------------------------------------------------------------------------
[2017-12-05 09:05:58] post at minhost dot no

Related To: Bug #75621

------------------------------------------------------------------------


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


Thread (52 messages)

« previous php.bugs (#213151) next »