Skip to content
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

Fix interned strings buffer check if 0 free bytes #36278

Merged
merged 1 commit into from
Jan 23, 2023
Merged

Conversation

MichaIng
Copy link
Member

@MichaIng MichaIng commented Jan 20, 2023

Summary

With #32902 it was meant to be avoided to recommend raising the interned strings buffer size above a quarter of the total OPcache size. This works as long as there is at least 1 byte free, but does not apply if the buffer is filled completely.

This commit switches the conditions so that the interned strings buffer size must be smaller than a quarter of the total OPcache size for the warning to be shown. That the buffer must be either filled completely or by more than 90% remains untouched.

TODO

  • ...

Checklist

@MichaIng MichaIng added enhancement 3. to review Waiting for reviews labels Jan 20, 2023
@MichaIng MichaIng added this to the Nextcloud 26 milestone Jan 20, 2023
@MichaIng MichaIng requested review from szaimen and come-nc January 20, 2023 21:05
@MichaIng MichaIng added the php Pull requests that update Php code label Jan 20, 2023
@MichaIng MichaIng enabled auto-merge January 20, 2023 21:15
Copy link
Contributor

@szaimen szaimen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but didnt test

@szaimen
Copy link
Contributor

szaimen commented Jan 21, 2023

/backport to stable25

@szaimen
Copy link
Contributor

szaimen commented Jan 21, 2023

/backport to stable24

@szaimen szaimen added bug and removed enhancement labels Jan 21, 2023
@MichaIng
Copy link
Member Author

Tested up and down with a bunch of combinations of OPcache size and interned strings buffer size and it works all as expected. And indeed, sometimes the interned strings buffer free memory was exactly 0 bytes, in which case the recommendation previously was still shown, even if interned strings buffer was already a quarter of overall OPcache size or larger. This in theory could have lead to a vicious cycle, at least if the interned strings buffer keeps being exhausted until last byte (which was not always the case in my tests, sometimes some bytes stayed free, which makes sense if there is no small fitting string to buffer):

  • Admin reacts to interned strings buffer recommendation and increases it.
  • Since the interned strings buffer is allocated directly as used part of the overall OPcache, now the OPcache could be used above the limit, triggering a related recommendation to raise its size. Admin reacts to it.
  • Due to the still unknown circumstances in some cases, especially also with Wordpress on same PHP instance, the interned strings buffer keeps being filled, triggering another warning.
  • Admin reacts, then OPcache again gets too small, etc etc.

So to finally silence all noise on that topic, this should be merged 😄.

@szaimen
Copy link
Contributor

szaimen commented Jan 23, 2023

/rebase

With #32902 it was meant to be avoided to recommend raising the interned strings buffer size above a quarter of the total OPcache size. This works as long as there is at least 1 byte free, but does not apply if the buffer is filled completely.

This commit switches the conditions so that the interned strings buffer size must be smaller than a quarter of the total OPcache size for the warning to be shown. That the buffer must be either filled completely or by more than 90% remains untouched.

Signed-off-by: MichaIng <micha@dietpi.com>
@Badb0yBadb0y
Copy link

Seems like it is not available in 27. I have the warning here too:

The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply opcache.interned_strings_buffer to your PHP configuration with a value higher than 8.

@MichaIng
Copy link
Member Author

MichaIng commented Aug 4, 2023

That this warning is shown in your case does not mean that you are effected by the bug fixed with this PR. Double check your OPcache settings, that opcache.interned_strings_buffer is set to at least 25% of opcache.memory_consumption, in case use opcache_get_status or opcache-gui to verify that those settings are applied correctly/effectively for requests to your Nextcloud instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: The OPcache interned strings buffer is nearly full
4 participants