NC does not use Redis despite proper definition in config.php

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 : 22.2.3.0
Operating system and version : Ubuntu 20.04 LTS
Apache or nginx version: Apache 2.4.51
PHP version: 8.0.13

The issue you are facing:
The definition of memcache.local and memcache.locking in config.php seems to be ignored by NC.
notify_push doesn’t seem to work as intended either (there’s a lag of several seconds until the Windows Client receives the notification). Perhaps, those two phenomenons are interconnected because notify_push relies on Redis.

No specific errors or warnings occurred.

Is this the first time you’ve seen this error?: No, it’s an ongoing issue.

Steps to replicate it:

  1. Install and configure Redis (redis-server, php8.0-redis)
    redis.conf: bind 127.0.0.1 ::1; port 6379; maxclients 512
    usermod -aG redis www-data

  2. Check if Nexcloud uses Redis for local caching and file locking (info taken from NC’s serverinfo):
    <memcache.local>none</memcache.local>
    <filelocking.enabled>yes</filelocking.enabled>
    <memcache.locking>none</memcache.locking>

→ there should be Redis shown for memcache.local and memcache.locking in accordance with config.php (see below)!

  1. Check if Redis is working using “occ notify_push:setup”
    ✓ redis is configured
    ✓ push server is receiving redis messages
    ✓ push server can load mount info from database
    ✓ push server can connect to the Nextcloud server
    ✓ push server is a trusted proxy
    ✓ push server is running the same version as the app

Create new file and check if Windows Client is notified:
1637841215.041738 [0 127.0.0.1:55822] “PUBLISH” “notify_storage_update” "{“storage”:5,“path”:“files\/test21.md”}"1637841215.042864 [0 127.0.0.1:55822] “PUBLISH” “notify_storage_update” “{“storage”:5,“path”:“files”}”

→ after this it took approximately 20sec until the Windows Client was updated!

redis log:
937:M 25 Nov 2021 13:14:45.541 # Server initialized
937:M 25 Nov 2021 13:14:45.541 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
937:M 25 Nov 2021 13:14:45.543 * DB loaded from disk: 0.002 seconds
937:M 25 Nov 2021 13:14:45.543 * Ready to accept connections
937:M 25 Nov 2021 13:29:46.023 * 1 changes in 900 seconds. Saving…
937:M 25 Nov 2021 13:29:46.023 * Background saving started by pid 1891
1891:C 25 Nov 2021 13:29:46.024 * DB saved on disk
1891:C 25 Nov 2021 13:29:46.025 * RDB: 0 MB of memory used by copy-on-write
937:M 25 Nov 2021 13:29:46.123 * Background saving terminated with success

notify_push.service:
[Unit]
Description=Push daemon for Nextcloud clients
After=apache2.service php-fpm.service mariadb.service redis.service
[Service]
Environment=PORT=7867
Environment=NEXTCLOUD_URL=https://XXX.XXX.com
Environment=DATABASE_URL=mysql://ABCDEFG:‘1234567890’@localhost/nextcloud
Environment=DATABASE_PREFIX=oc_
Environment=REDIS_URL=redis://localhost
ExecStart=/var/www/nextcloud/apps/notify_push/bin/x86_64/notify_push /var/www/nextcloud/config/config.php
User=www-data
[Install]
WantedBy=multi-user.target

The output of your Nextcloud log in Admin > Logging: no errors/warnings

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

    'memcache.local' => '\\OC\\Memcache\\Redis',
    'memcache.locking' => '\\OC\\Memcache\\Redis',
    'filelocking.enabled' => 'true',
    'redis' =>
    array (
      'host' => 'localhost',
      'port' => 6379,
      'timeout' => 0,
      'password' => '',
      'dbindex' => 0,
    ),

The output of your Apache/nginx/system log in /var/log/____:

[Thu Nov 25 13:14:45.433224 2021] [ssl:warn] [pid 836] AH01909: XYZ.localdomain:443:0 server certificate does NOT include an ID which matches the server name
[Thu Nov 25 13:14:45.534291 2021] [ssl:warn] [pid 907] AH01909: XYZ.localdomain:443:0 server certificate does NOT include an ID which matches the server name
[Thu Nov 25 13:14:45.543628 2021] [mpm_prefork:notice] [pid 907] AH00163: Apache/2.4.51 (Ubuntu) OpenSSL/1.1.1f configured -- resuming normal operations
[Thu Nov 25 13:14:45.543645 2021] [core:notice] [pid 907] AH00094: Command line: '/usr/sbin/apache2'

Perhaps someone has an idea what could be the issue here!

Many thanks,
Niklas

it’s not in the examples from the documentation, are you sure it is possibe?
https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/caching_configuration.html

Hi,

I followed the documentation:
"Additional notes for Redis vs. APCu on memory caching

APCu is faster at local caching than Redis. If you have enough memory, use APCu for Memory Caching and Redis for File Locking. If you are low on memory, use Redis for both."

I opted for the latter and used Redis for both.
Anyway, even if I use APCu for local caching it’s not used by Nextcloud. APCu is installed and enabled according to phpinfo() but Nextcloud’s ServerInfo denies that:
<memcache.local>none</memcache.local>
<filelocking.enabled>yes</filelocking.enabled>
<memcache.locking>none</memcache.locking>

config.php:
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘filelocking.enabled’ => ‘true’,
‘redis’ =>
array (
‘host’ => ‘localhost’,
‘port’ => 6379,
‘timeout’ => 0,
‘password’ => ‘’,
‘dbindex’ => 0,

The only issue I noticed with APCu is that apc.enable_cli is 0 despite I’ve put apc.enable_cli = 1 into the php.ini.

It seems to me that no matter which cache I define it’s going to be ignored…

There are often different php.ini files for CLI (e.g. /etc/php/cli) and for apache ( /etc/php/apache) or php-fpm (/etc/php/fpm). Depending on distribution, php versions etc. this can be a bit different.