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

warning: PHP OPcache module is not properly configured: OPcache buffer is nearly full #1965

Closed
meonkeys opened this issue Apr 9, 2023 · 10 comments

Comments

@meonkeys
Copy link
Contributor

meonkeys commented Apr 9, 2023

I'm getting a warning on the Security & setup warnings page (/settings/admin/overview). First I've seen this one. In the past I've seen warnings about string buffers (mentioned in other issues).

Security & setup warnings

It's important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the linked documentation for more information.

There are some warnings regarding your setup.

  • The PHP OPcache module is not properly configured. See the documentation ↗ for more information.
    • The OPcache buffer is nearly full. To assure that all scripts can be hold in cache, it is recommended to apply opcache.memory_consumption to your PHP configuration with a value higher than 128.

Please double check the installation guides ↗, and check for any errors or warnings in the log.

Check the security of your Nextcloud over our security scan ↗.

Screenshot from 2023-04-08 17-12-51

I'm using:

  • version 25.0.7.1 (also saw this warning with 25.0.5.1)
  • image tag: nextcloud:25.0.5-apache
  • image SHA256 checksum: 1dd8f331fb758655eb3b2e6388b7cff26f2a90dc0bec25f8d2af1dbdbf538234

opcache.memory_consumption is how many megabytes to use in shared memory storage for OPcache. The minimum is 8 and the default is 128.

Questions:

  1. Why might OPcache be running out? Too many apps? Misbehaving apps? Misconfiguration? This is expected, and the default should be changed?
  2. The warning says opcache.memory_consumption should be increased. How much? Is there a reasonable upper bound besides just "however much system memory you can spare"? What's the best practice here?
  3. I don't notice any negative symptoms related to this warning. Should it be less severe than a warning? What kinds of symptoms might I expect to see? If the cache is rank-ordered by usefulness (say, those scripts with the most hits get to stay in the cache, those with the fewest are ejected) maybe I don't care if a few rarely used scripts aren't cached.
@meonkeys
Copy link
Contributor Author

meonkeys commented Apr 9, 2023

I destroyed and re-created my Nextcloud app container and the warning went away. I don't have a repro. Maybe it was running for a long time?

@meonkeys meonkeys closed this as completed Apr 9, 2023
@meonkeys
Copy link
Contributor Author

meonkeys commented Apr 21, 2023

This error message popped up again, but the server seems to be working fine. No other symptoms that I can tell.

@ghost
Copy link

ghost commented Apr 26, 2023

Will the problem be fixed or is there a solution for this error?

@meonkeys
Copy link
Contributor Author

@R7JANV1 are you seeing this warning?

@ghost
Copy link

ghost commented Apr 26, 2023

@R7JANV1 are you seeing this warning?

Yes!

@meonkeys
Copy link
Contributor Author

meonkeys commented Apr 26, 2023

Ok. @R7JANV1 , can you add any details about your setup, what you've tried or researched already? Also--side note--for a "me too" comment, consider adding your thumbs up to the original issue description.

The obvious solution (as rawtaz pointed out in #nextcloud on LiberaChat IRC) is to increase the value. But I have questions--I just added them to the description. I'd like to know the root cause. If the root cause is script(s) in a default nextcloud install, perhaps opcache.memory_consumption should be increased in the Dockerfile. If the root cause is an installed app, perhaps there is a problem with that app. If the root cause is related to some other resource usage (e.g. how many folders or files I have in my instance, how many apps I have installed), then maybe we can come up with some usage-specific guidance for the opcache.memory_consumption value.

https://www.saotn.org/optimize-php-opcache-configuration/ might help us figure this out.

I tried opcache_get_status(). Here's part of that output:

  ["memory_usage"]=>
  array(4) {
    ["used_memory"]=>
    int(123349000)
    ["free_memory"]=>
    int(10865416)
    ["wasted_memory"]=>
    int(3312)
    ["current_wasted_percentage"]=>
    float(0.002467632293701172)
  } 

The scripts consuming the most memory in my instance are:

  1. /var/www/html/3rdparty/scssphp/scssphp/src/Compiler.php: 793400
  2. /var/www/html/custom_apps/phonetrack/lib/Controller/PageController.php: 412072
  3. /var/www/html/apps/dav/lib/CalDAV/CalDavBackend.php: 339960

1 is probably core nc code, 3 is something I need for calendar, and 2 is for phonetrack. If phonetrack used 10x that, it might be worth disabling. Skimming the rest of the scripts, it looks like memory usage is pretty well spread out, so perhaps the warning is just due to the number of scripts period (as opposed to a particular misbehaving script or app).

@meonkeys meonkeys changed the title PHP OPcache module is not properly configured: OPcache buffer is nearly full warning: PHP OPcache module is not properly configured: OPcache buffer is nearly full Apr 26, 2023
@ghost
Copy link

ghost commented Apr 26, 2023

I recently migrated my Nextcloud All in One instance from my Ubuntu Server to TrueNAS. There I linked a Nextcloud container and a database container using the built-in Kubernetes Docker function and migrated the data and database of the old instance to the new instance on TrueNAS.

@meonkeys
Copy link
Contributor Author

meonkeys commented Apr 26, 2023

Have you tried changing opcache.memory_consumption?

On my end I've decided to ignore the warning until I see some other symptom besides the warning itself.

@AlterDepp
Copy link

Warning still exists on NC 27.1.1

@nikbpetrov
Copy link

For me, it's an error - NC 28.0.8.

Interestingly - maybe due to my own ignorance - I don't have a php.ini files in /usr/local/etc but I do have /usr/local/etc/php/php.truenas.ini, which I believe is the same (although would be excited to be corrected if this is not the case).

My config is:

opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=10000
opcache.revalidate_freq=1
opcache.save_comments=1

The opcache thing used to be a warning but since some time (idk when or why) it has become an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants