OPCache trying to allocate insane amount of memory

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 13.0.2
Operating system and version: CentOS 7.5.1804
Apache or nginx version: Apache 2.4.6
PHP version: 7.0

The issue you are facing: I set up a local memcache using acpu and started getting 500 errors. The /var/log/httpd/error_log contains alarming notices like the following:

[Sat Jun 02 18:58:40.379902 2018] [:error] [pid 26417] [client 192.168.1.1:58316] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 140239976489248 bytes) in /home/cloud/public_html/nextcloud/lib/private/Template/SCSSCacher.php on line 282
[Sat Jun 02 18:58:42.545737 2018] [:error] [pid 26915] [client 192.168.1.1:58318] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 140239976489248 bytes) in /home/cloud/public_html/nextcloud/lib/private/Template/SCSSCacher.php on line 282
[Sat Jun 02 18:58:43.380534 2018] [:error] [pid 26916] [client 192.168.1.1:58322] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 140239976489248 bytes) in /home/cloud/public_html/nextcloud/lib/private/Template/SCSSCacher.php on line 282
[Sat Jun 02 18:58:49.360430 2018] [:error] [pid 26917] [client 192.168.1.1:58324] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 140239976520832 bytes) in /home/cloud/public_html/nextcloud/lib/private/Template/SCSSCacher.php on line 282

Now, I don’t know why this is trying to allocate a whole 127 TiB of RAM, and this is clearly some sort of error for something that’s only supposed to allocate at most a couple hundred MiB instead, but I can’t use the memcache because of this. Fortunately my cloud seems completely responsive, so I question whether I really need to use this.

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

  1. Install and enable acpu memcache.
  2. Try to do anything in nextCloud.
  3. Get error 500.

The output of your Nextcloud log in Admin > Logging:

https://pastebin.com/ARrCkdn2

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => SNIPPED FOR SECURITY,
  'passwordsalt' => SNIPPED FOR SECURITY,
  'secret' => SNIPPED FOR SECURITY,
  'trusted_domains' => 
  array (
    0 => SNIPPED FOR SECURITY,
  ),
  'datadirectory' => '/home/cloud/public_html/nextcloud/data',
  'overwrite.cli.url' => SNIPPED FOR SECURITY,
  'dbtype' => 'mysql',
  'version' => '13.0.2.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => SNIPPED FOR SECURITY,
  'dbpassword' => SNIPPED FOR SECURITY,
  'installed' => true,
  'debug' => true,
  'memcache.local' => '\OC\Memcache\APCu',
);

The output of your Apache/nginx/system log in /var/log/httpd/error_log:
https://pastebin.com/YfSdn5Ae

@juliushaertl any ideas why so much resources are needed? Some config problem?

@Yaro_Kasear Can you try to setup opcache for your server according to https://docs.nextcloud.com/server/13/admin_manual/configuration_server/server_tuning.html#enable-php-opcache

I still cannot reproduce the issue, but enabling the opcache seems to have fixed it for some other users: https://github.com/nextcloud/server/issues/5249