[SOLVED] REDIS socket issue : RedisException: Redis server went away

Nextcloud version (eg, 20.0.5): 27.0.0
Operating system and version (eg, Ubuntu 20.04): AlmaLinux release 8.8 (Sapphire Caracal)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.37 (AlmaLinux)
PHP version (eg, 7.4): PHP 8.1.20

When i set up memcache with redis, web UI is not working anymore.

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

Steps to replicate it:

  1. in config.php
    ‘memcache.local’ => ‘\OC\Memcache\APCu’,
    ‘filelocking.enabled’ => true,
    ‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
    ‘memcache.locking’ => ‘\OC\Memcache\Redis’,
    ‘redis’ =>
    array (
    ‘host’ => ‘/tmp/redis.sock’,
    ‘port’ => 0,
    ‘timeout’ => 0,
    ),

  2. Refresh Browser

  3. getting internal server error.

The output of your Nextcloud log in Admin > Logging:

Error	core	RedisException: Redis server went away
/var/www/html/nextcloud/lib/private/Memcache/Redis.php - line 72:

Redis->get()

/var/www/html/nextcloud/lib/private/Memcache/WithLocalCache.php - line 24:

OC\Memcache\Redis->get()

/var/www/html/nextcloud/lib/private/User/Manager.php - line 169:

OC\Memcache\WithLocalCache->get()

/var/www/html/nextcloud/lib/private/User/Session.php - line 228:

OC\User\Manager->get()

/var/www/html/nextcloud/lib/private/L10N/Factory.php - line 286:

OC\User\Session->getUser()

/var/www/html/nextcloud/lib/private/L10N/Factory.php - line 155:

OC\L10N\Factory->findLocale()

/var/www/html/nextcloud/lib/private/L10N/LazyL10N.php - line 44:

OC\L10N\Factory->OC\L10N\{closure}("*** sensiti ... *")

/var/www/html/nextcloud/lib/private/L10N/LazyL10N.php - line 51:

OC\L10N\LazyL10N->getL()

/var/www/html/nextcloud/core/templates/exception.php - line 24:

OC\L10N\LazyL10N->t()

/var/www/html/nextcloud/lib/private/Template/Base.php - line 180:

include("/var/www/ht ... p")

/var/www/html/nextcloud/lib/private/Template/Base.php - line 150:

OC\Template\Base->load()

/var/www/html/nextcloud/lib/private/legacy/OC_Template.php - line 179:

OC\Template\Base->fetchPage()

/var/www/html/nextcloud/lib/private/Template/Base.php - line 132:

OC_Template->fetchPage()

/var/www/html/nextcloud/lib/private/legacy/OC_Template.php - line 331:

OC\Template\Base->printPage()

/var/www/html/nextcloud/index.php - line 74:

OC_Template::printExceptionErrorPage()

	2023-07-03T16:46:53+0200
Error	core	RedisException: No such file or directory		2023-07-03T16:46:53+0200
Error	index	RedisException: No such file or directory
/var/www/html/nextcloud/lib/private/RedisFactory.php - line 137:

Redis->pconnect()

/var/www/html/nextcloud/lib/private/RedisFactory.php - line 178:

OC\RedisFactory->create("*** sensiti ... *")

/var/www/html/nextcloud/lib/private/Memcache/Redis.php - line 66:

OC\RedisFactory->getInstance()

/var/www/html/nextcloud/lib/private/Memcache/Redis.php - line 72:

OC\Memcache\Redis->getCache()

/var/www/html/nextcloud/lib/private/Memcache/WithLocalCache.php - line 24:

OC\Memcache\Redis->get()

/var/www/html/nextcloud/lib/private/User/Manager.php - line 169:

OC\Memcache\WithLocalCache->get()

/var/www/html/nextcloud/lib/private/User/Session.php - line 228:

OC\User\Manager->get()

/var/www/html/nextcloud/lib/private/legacy/OC_App.php - line 228:

OC\User\Session->getUser()

/var/www/html/nextcloud/lib/private/App/AppManager.php - line 198:

OC_App::getEnabledApps()

/var/www/html/nextcloud/lib/private/legacy/OC_App.php - line 126:

OC\App\AppManager->loadApps()

/var/www/html/nextcloud/lib/private/legacy/OC_User.php - line 128:

OC_App::loadApps()

/var/www/html/nextcloud/lib/base.php - line 766:

OC_User::setupBackends()

/var/www/html/nextcloud/lib/base.php - line 1173:

OC::init()

/var/www/html/nextcloud/index.php - line 34:

require_once("/var/www/ht ... p")

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

<?php
$CONFIG = array (
  'instanceid' => 'oc5l3qvdrvdvdrvdvf9w81h',
  'passwordsalt' => 'refvsvsvdvrIXFslcarqh5RR',
  'secret' => 'tvt75vrvdrvrvrdvdvdrvdrvdrvdvdrvdrvrdvWCFMl4aj8ywGiL7',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'xxxxx',
  ),
  'datadirectory' => '/DATA',
  'dbtype' => 'mysql',
  'version' => '27.0.0.8',
  'overwrite.cli.url' => 'https://xxx',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'Nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'installed' => true,
  'mail_from_address' => 'drive',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'xxx',
  'mail_smtphost' => 'xx',
  'mail_smtpport' => '25',
  'logfile' => '/var/log/nextcloud.log',
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
  array (
    'host' => '/tmp/redis.sock',
    'port' => 0,
    'timeout' => 0,
  ),
  'default_phone_region' => 'FR',
  'defaultapp' => 'files',
  'default_language' => 'en',
  'force_language' => 'en',
  'knowledgebaseenabled' => false,
  'session_lifetime' => 3600,
  'enable_previews' => false,
  'maintenance' => false,
  'ldapUserCleanupInterval' => 32,
  'loglevel' => 2,
);

Redis is working fine.
no error on redis log.
redis-cli -s /tmp/redis.sock MONITOR
OK (and no more log)

Thanks.

What are the file permissions on /tmp/redis.sock?

Hello
Permissions are 777.
Thanks.

You’re not using containers or anything?

An SELinux interaction maybe?

Hello,
No containers.
Yes selinux is enforced but even with selinux in permissive it does not work.

What happens if you change the socket to a more typical location like /run/ in both your redis configuration and your NC redis configuration?

Another possibility is that your config.php isn’t actually active (which can happen with some opcache setting scenarios). Can you restart your web-app server(s) (web+fpm if applicable)?

Thanks jtr!

with that it is working.
Wonderfull!

‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘/run/redis/redis.sock’,
‘port’ => 0,
‘timeout’ => 0,
),