-
Notifications
You must be signed in to change notification settings - Fork 7.8k
opcache.interned_strings_buffer either has no effect or opcache_get_status() / phpinfo() is wrong #11715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I just tried this and got a different, but equally weird result. EDIT: I don't understand this code: php-src/ext/opcache/ZendAccelerator.c Lines 2904 to 2906 in cbd903d
I would've expected this instead: ZCSG(interned_strings).end =
(zend_string*)((char*)ZCSG(interned_strings).start +
ZCG(accel_directives).interned_strings_buffer * 1024 * 1024); i.e. to compute the end, instead of starting from the start of the struct, we start at the interned string table start. This makes more sense to me. And this yields the right result on my computer. But I'm not sure, I didn't look too deep into it yet as I'm out of time for today. EDIT 2: Wait but then this line is also wrong: php-src/ext/opcache/ZendAccelerator.c Line 2864 in cbd903d
I'm confused |
Glad you could confirm!
Well, sorry to add to the confusion, but I actually had it set to |
I think I figured it out and will try to create a PR soon. |
… or opcache_get_status() / phpinfo() is wrong There are a couple of oddities. 1) The interned strings buffer comprises the whole hashtable datastructure. Therefore, it seems that the interned strings buffer size is the size of only said table. However, in the current code it also includes the size of the zend_accel_shared_globals. 2) ZCSG(interned_strings).end is computed starting from the accelerator globals struct itself. I would expect it to start from the part where the interned strings table starts. 3) When computing the used size, it is done using ZCSG(interned_strings).end - ZCSG(interned_strings).start. However, this does not include the uin32_t slots array because ZCSG(interned_strings).start pointers after that array. This patch corrrects these 3 points.
… or opcache_get_status() / phpinfo() is wrong There are a couple of oddities. 1) The interned strings buffer comprises the whole hashtable datastructure. Therefore, it seems that the interned strings buffer size is the size of only said table. However, in the current code it also includes the size of the zend_accel_shared_globals. 2) ZCSG(interned_strings).end is computed starting from the accelerator globals struct itself. I would expect it to start from the part where the interned strings table starts. 3) When computing the used size, it is done using ZCSG(interned_strings).end - ZCSG(interned_strings).start. However, this does not include the uin32_t slots array because ZCSG(interned_strings).start pointers after that array. This patch corrrects these 3 points.
* PHP-8.1: Fix GH-11715: opcache.interned_strings_buffer either has no effect or opcache_get_status() / phpinfo() is wrong
* PHP-8.2: Fix GH-11715: opcache.interned_strings_buffer either has no effect or opcache_get_status() / phpinfo() is wrong
Description
In my php.ini I have set
opcache.interned_strings_buffer
to16
.phpinfo()
confirms this:But
opcache_get_status()
...and
phpinfo()
...... show
interned_strings_usage['buffer_size']
as full at ~6mb.I don't know if it's relevant, but opcache has enough free memory:
But the
used_memory
andfree_memory
also add up to a different value than the1024
I set foropcache.memory_consumption
, although close.PHP Version
8.2.8
Operating System
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: