Memory Caching brakes Nextcloud

Nextcloud version (eg, 12.0.2): 15.0.2
Operating system and version (eg, Ubuntu 17.04): Raspbian buster
Apache or nginx version (eg, Apache 2.4.25): nginx 1.14.2
PHP version (eg, 7.1): PHP 7.2

The issue you are facing:
If I add 'memcache.local' => '\OC\Memcache\APCu', to my nextcloud config it makes my Nextcloud unusable until I remove the line again. There is this error on Nextcloud if I add it:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. I added 'memcache.local' => '\OC\Memcache\APCu', to the config.
  2. Refreshed my Nextcloud site.

The output of your Nextcloud log in Admin > Logging:


\\Memcache\\Factory"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/ServerContainer.php","line":132,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OC\\Memcache\\Factory"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php","line":165,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\Memcache\\Factory"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php","line":114,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["MemCacheFactory"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/ServerContainer.php","line":132,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["MemCacheFactory"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/Server.php","line":1533,"function":"query","class":"OC\\ServerContainer","type":"->","args":["MemCacheFactory"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/Server.php","line":697,"function":"getMemCacheFactory","class":"OC\\Server","type":"->","args":[]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OC\\App\\AppManager"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/ServerContainer.php","line":132,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OC\\App\\AppManager"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php","line":165,"function":"query","class":"OC\\ServerContainer","type":"->","args":["OC\\App\\AppManager"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php","line":114,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php","line":117,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["AppManager"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/ServerContainer.php","line":132,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["AppManager"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/Server.php","line":1723,"function":"query","class":"OC\\ServerContainer","type":"->","args":["AppManager"]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/legacy\/app.php","line":342,"function":"getAppManager","class":"OC\\Server","type":"->","args":[]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/legacy\/app.php","line":113,"function":"getEnabledApps","class":"OC_App","type":"::","args":[]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/base.php","line":654,"function":"loadApps","class":"OC_App","type":"::","args":[["session"]]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/base.php","line":1068,"function":"init","class":"OC","type":"::","args":[]},{"file":"\/var\/www\/[hidden for privacy reasons]\/public_html\/index.php","line":40,"args":["\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/base.php"],"function":"require_once"}],"File":"\/var\/www\/[hidden for privacy reasons]\/public_html\/lib\/private\/Memcache\/Factory.php","Line":99,"Hint":"Is the matching PHP module installed and enabled?","CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/71.0.3578.98 Safari\/537.36","version":"15.0.2.0"}

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

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxx'
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  'trusted_domains' => 
  array (
    0 => 'xxxxxxxxxxxxxxxxxxxxxxx.xxx'
  ),
  'datadirectory' => '/media/Nextcloud/data'
  'dbtype' => 'mysql',
  'version' => '15.0.2.0',
  'overwrite.cli.url' => 'xxxxxxxxxxxxxxxxxxxx.xxx'
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxxxxxxxx',
  'dbpassword' => 'xxxxxxxxxxxxxxxxxx',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpport' => '465',
  'mail_smtphost' => 'xxxxxxxxxxxxxxxx',
  'mail_domain' => 'xxxxxxxxxxxx',
  'mail_from_address' => 'xxxxxxxxxxxxxxxx',
  'mail_smtpname' => 'xxxxxxxxxxxxxxxxx',
  'mail_smtppassword' => 'xxxxxxxxxxxxxxxxxxxxxxx',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
);

Did you install the APCu module for your PHP version?
apt install php-apcu

Also I see you are on Raspbian Buster but have PHP7.2 installed. Note that even on Raspbian, Buster repo now moved to PHP7.3.
I am not sure if the APCu module package works for PHP7.2 as well, but I suggest you follow the default and switch to PHP7.3.

This will most likely not change to the next PHP version anymore, since Debian Buster release is coming soon and the first package freeze for major changes has already been applied last weekend.

1 Like

Ok so upgrading to php7.3 helped but now I am getting another error now I didn’t had before (I have php-imagick installed on my Pi):

Just checked and jep, the php-imagick module on Raspbian Buster is not yet ported to PHP7.3:

2019-01-15 22:02:49 root@micha:/tmp# apt show php-imagick
Package: php-imagick
Version: 3.4.3-4
Priority: optional
Section: php
Maintainer: Debian PHP PECL Maintainers <team+php-pecl@tracker.debian.org>
Installed-Size: 362 kB
Provides: php7.2-imagick
Depends: php-common (>= 1:7.0+33~), phpapi-20170718, libc6 (>= 2.4), libmagickcore-6.q16-6 (>= 8:6.9.10.2), libmagickwand-6.q16-6 (>= 8:6.9.10.2)
Recommends: ghostscript, ttf-dejavu-core
Homepage: http://pecl.php.net/package/imagick
Download-Size: 81.3 kB
APT-Sources: https://ftp.gwdg.de/pub/linux/debian/raspbian/raspbian buster/main armhf Packages

Similar thing was the case for php-apcu and php-redis for a long time, as well on switch from PHP7.0/1 to PHP7.2. The repo maintainers do not take care dependencies very well when updating certain packages. On Debian Buster works rock solid related to this: If any package is updated on the repo, all it’s dependencies and dependants are updated/adjusted/fixed accordingly, so all is consistent, but on Raspbian I regularly ran into such issues. There were cases where an automated dist-upgrade would have purged half of my system, e.g. whole MariaDB instance, webserver stack and such… :angry:. However it’s still “testing”, so issues should be accepted by everyone who applies this branch.

Interesting that on my system (Raspbian Buster as well) I do not face this warning. Perhaps it depends on enabled apps. E.g. I don’t have theming enabled, hmm but gallery, which should be the one which has some use for imagick.

However simply ignore this issue. There are current discussion on this forum that this PHP module actually implies some security vulnerabilities, so should be not used and the warning removed from Nextcloud admin panel.
If you really want it, you can download the PHP7.3 module from Debian Buster repo and install it on your Raspbian. For APCu and Redis modules this worked very well for me that time: https://packages.debian.org/en/buster/armhf/php-imagick/download

1 Like

Ok thank you very much! I very appreciate your help, you helped me a lot.

1 Like