Bug #80002 [Asn]: calc free space for new interned string is wrong

From: Date: Fri, 21 Aug 2020 01:34:14 +0000
Subject: Bug #80002 [Asn]: calc free space for new interned string is wrong
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228697@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80002&edit=1

 ID:                 80002
 User updated by:    t-matsuno at colopl dot co dot jp
 Reported by:        t-matsuno at colopl dot co dot jp
 Summary:            calc free space for new interned string is wrong
 Status:             Assigned
 Type:               Bug
 Package:            opcache
 PHP Version:        PHP 7.3
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

> a string that would encounter this bug
"bootstrap/cache/routes.php" generated by Laravel has a very big base64 string which is
800k long in our case and encounters this bug.

We encountered the overflow warning when we were upgrading our PHP version from 7.2, then I started
to see how much to configure the buffer size and found that the interned strings buffer used memory
of opcache_get_status was not so high but the overflow occurred in the routes.php.

Tests were mainly just loading the file with increasing opcache.interned_strings_buffer gradually,
and GDB step out after I found the threshold.

Thanks for looking at this report.


Previous Comments:
------------------------------------------------------------------------
[2020-08-20 12:29:28] danack@php.net

"I looked ZendAccelerator and tried some tests.
Through the series of tests, it seems that the calculation for free space to keep interned strings
is wrong"

Thanks for the patch.

Would it be possible for you to write a few words about the tests you did, and how they lead to
finding this issue?

And also an example of a string that would encounter this bug would be lovely.

------------------------------------------------------------------------
[2020-08-20 09:25:40] cmb@php.net

The following pull request has been associated:

Patch Name: Fix #80002: calc free space for new interned string is wrong
On GitHub:  https://github.com/php/php-src/pull/6024
Patch:      https://github.com/php/php-src/pull/6024.patch

------------------------------------------------------------------------
[2020-08-20 09:23:56] cmb@php.net

Thanks for reporting, and the patch!

------------------------------------------------------------------------
[2020-08-20 09:09:48] t-matsuno at colopl dot co dot jp

Description:
------------
Hello,

Since I got "Interned string buffer overflow" warning with relatively large
opcache.interned_strings_buffer, I looked ZendAccelerator and tried some tests.
Through the series of tests, it seems that the calculation for free space to keep interned strings
is wrong and it derives the 1/32 smaller value than the actual free space and it causes the overflow
warning for some big strings even if there is enough free space.

I hope you look at it.
This happens in PHP7.3 and newer.

Regards,
Takeki.



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



--
Edit this bug report at https://bugs.php.net/bug.php?id=80002&edit=1


Thread (6 messages)

« previous php.bugs (#228697) next »