Error: RedisException: No such file or directory at <<closure>>

Hello,

I’ve done a fresh install and after some trouble, Nextcloud is up and running. As it was initially very slow to load pages, I set up ACPu for memory caching, and then Redis and file locking according to the admin instructions.

However, under Admin > Logging, I get three times the error, per second (!):

[no app in context] Error: RedisException: No such file or directory at <<closure>>

 0. /var/www/nextcloud/lib/private/RedisFactory.php line 92
    Redis->connect("/var/run/redis/redis.sock", 0, 1.5)
 1. /var/www/nextcloud/lib/private/RedisFactory.php line 108
    OC\RedisFactory->create()
 2. /var/www/nextcloud/lib/private/Memcache/Redis.php line 43
    OC\RedisFactory->getInstance()
 3. /var/www/nextcloud/lib/private/Memcache/Factory.php line 135
    OC\Memcache\Redis->__construct("355f489b81a047d6485a32d4ffa1523a/lock")
 4. /var/www/nextcloud/lib/private/Server.php line 1021
    OC\Memcache\Factory->createLocking("lock")
 5. /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php line 118
    OC\Server->OC\{closure}("*** sensitive parameters replaced ***")
 6. /var/www/nextcloud/lib/private/ServerContainer.php line 124
    Pimple\Container->offsetGet("OCP\\Lock\\ILockingProvider")
 7. /var/www/nextcloud/lib/private/Server.php line 1970
    OC\ServerContainer->query("OCP\\Lock\\ILockingProvider")
 8. /var/www/nextcloud/lib/private/Files/View.php line 118
    OC\Server->getLockingProvider()
 9. /var/www/nextcloud/lib/private/Server.php line 810
    OC\Files\View->__construct()
10. /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php line 118
    OC\Server->OC\{closure}("*** sensitive parameters replaced ***")
11. /var/www/nextcloud/lib/private/ServerContainer.php line 124
    Pimple\Container->offsetGet("OCP\\Http\\Client\\IClientService")
12. /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 388
    OC\ServerContainer->query("OCP\\Http\\Client\\IClientService", true)
13. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 71
    OC\AppFramework\DependencyInjection\DIContainer->query("OCP\\Http\\Client\\IClientService", true)
14. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 101
    OC\AppFramework\Utility\SimpleContainer->buildClass(ReflectionClass  ... "})
15. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 116
    OC\AppFramework\Utility\SimpleContainer->resolve("OCA\\Support\\S ... e")
16. /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 414
    OC\AppFramework\Utility\SimpleContainer->query("OCA\\Support\\S ... e")
17. /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 385
    OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback("OCA\\Support\\S ... e")
18. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 71
    OC\AppFramework\DependencyInjection\DIContainer->query("OCA\\Support\\S ... e", true)
19. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 101
    OC\AppFramework\Utility\SimpleContainer->buildClass(ReflectionClass  ... "})
20. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 116
    OC\AppFramework\Utility\SimpleContainer->resolve("OCA\\Support\\S ... r")
21. /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 414
    OC\AppFramework\Utility\SimpleContainer->query("OCA\\Support\\S ... r")
22. /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 385
    OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback("OCA\\Support\\S ... r")
23. /var/www/nextcloud/apps/support/lib/AppInfo/Application.php line 48
    OC\AppFramework\DependencyInjection\DIContainer->query("OCA\\Support\\S ... r")
24. /var/www/nextcloud/apps/support/appinfo/app.php line 27
    OCA\Support\AppInfo\Application->register()
25. /var/www/nextcloud/lib/private/legacy/OC_App.php line 266
    require_once("/var/www/nextcl ... p")
26. /var/www/nextcloud/lib/private/legacy/OC_App.php line 155
    OC_App::requireAppFile(OCA\Support\AppInfo\Application {})
27. /var/www/nextcloud/lib/private/legacy/OC_App.php line 128
    OC_App::loadApp("support")
28. /var/www/nextcloud/lib/base.php line 647
    OC_App::loadApps(["session"])
29. /var/www/nextcloud/lib/base.php line 1090
    OC::init()
30. /var/www/nextcloud/ocs/v1.php line 33
    require_once("/var/www/nextcloud/lib/base.php")
31. /var/www/nextcloud/ocs/v2.php line 24
    require_once("/var/www/nextcloud/ocs/v1.php")

GET /ocs/v2.php/apps/notifications/api/v2/notifications
from 192.168.178.10 at 2020-08-27T06:16:55+00:00

This is included in /var/www/nextcloud/config/config.php:

  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'dbindex' => 0,
    'password' => 'secret',
    'timeout' => 1.5,
  ),

The following two blocks already exist in /etc/redis/redis.conf, so that seems fine, too?

port 0
[...]
unixsocket /var/run/redis/redis-server.sock
unixsocketperm 770

redis-server.service is active and running fine, it seems.

sudo -u www-data redis-cli -s /var/run/redis/redis.sock ping (following this tip) returns PONG, so www-data has access.

Searching for RedisException didn’t return anything I could interpret as a hint. Anyone could point me in the right direction?

(@MichaIng I see you’ve worked on Redis here on the forum before - would you be willing to have a look?)

You socket names do not match. Even that the symlink seems to be in place, please try to use the actual “modern” socket location in Redis and Nextcloud: /run/redis/redis-server.sock

If that doesn’t solve it, I remember even with 770 mode and www-data in redis group for some unexplained reason during early Debian Bullseye times PHP/Nextcloud was not able to connect. Meanwhile it does in my case but temporarily I needed to set: unixsocketperm 777

Thank you so much! Updating socket names (using the ‘modern’ location) did the trick :smiley:

Great.

If anyone is interested about the story behind the “modern” location /run vs /var/run:

Many, especially older packages still tend to use /var/run but distros and FHS advise to use /run for such kind of files and hence the /var/run -> /run symlinks or bind mounts usually exist.

2 Likes