Redis Server went away

Hi, i am getting “Redis Server went away” on every full Filescan (on the server itself using occ) AFTER updating my Distro (opensuse 15.0 to 15.1) without changing NC or any Configuration itself. As i can see, the redis - version had changed from 4.0.6 to 4.0.11 (besides the new php-fpm version and kernel of course).
Also i am getting that error SOMETIMES in normale usage - but not always and not always at the same files. But it happens quite often and full filescan is never working until it reaches its end.
The strange thing is, that basically everything else works fine. Redis is used in NC as memchache and for filelocking.
I also changed from Socket to tcp and Back -> always getting the same error. Also i updated Redis to 5.0.5 getting the same behaviour.

It looks more like smoe basic problem with Redis, but maybe someone here nows what went wrong, So:
Does anyone have the same Problem and solved it somehow? Or has anybody some hints to avoid this?

Here is the Log:

Doing Nextcloud Filescan...
Fri Oct 18 01:06:01 CEST 2019
0 orphaned file cache entries deleted
Starting scan for user 1 out of 1 (music)
Exception during scan: Redis server /var/run/redis/redis.sock:0 went away
#0 /srv/www/htdocs/owncloud/lib/private/Memcache/Redis.php(162): Redis->watch('138da89189a1410...')
#1 /srv/www/htdocs/owncloud/lib/private/Lock/MemcacheLockingProvider.php(95): OC\Memcache\Redis->cad('files/03c90d770...', 1)
#2 /srv/www/htdocs/owncloud/lib/private/Files/Storage/Common.php(747): OC\Lock\MemcacheLockingProvider->releaseLock('files/03c90d770...', 1)
#3 /srv/www/htdocs/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(604): OC\Files\Storage\Common->releaseLock('', 1, Object(OC\Lock\MemcacheLockingProvider))
#4 /srv/www/htdocs/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(604): OC\Files\Storage\Wrapper\Wrapper->releaseLock('', 1, Object(OC\Lock\MemcacheLockingProvider))
#5 /srv/www/htdocs/owncloud/lib/private/Files/Cache/Scanner.php(344): OC\Files\Storage\Wrapper\Wrapper->releaseLock('', 1, Object(OC\Lock\MemcacheLockingProvider))
#6 /srv/www/htdocs/owncloud/lib/private/Files/Utils/Scanner.php(245): OC\Files\Cache\Scanner->scan('', true, 3)
#7 /srv/www/htdocs/owncloud/apps/files/lib/Command/Scan.php(145): OC\Files\Utils\Scanner->scan('/music', true, NULL)
#8 /srv/www/htdocs/owncloud/apps/files/lib/Command/Scan.php(201): OCA\Files\Command\Scan->scanFiles('music', '/music', Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false)
#9 /srv/www/htdocs/owncloud/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /srv/www/htdocs/owncloud/core/Command/Base.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /srv/www/htdocs/owncloud/3rdparty/symfony/console/Application.php(901): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /srv/www/htdocs/owncloud/3rdparty/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /srv/www/htdocs/owncloud/3rdparty/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /srv/www/htdocs/owncloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /srv/www/htdocs/owncloud/console.php(97): OC\Console\Application->run()
#16 /srv/www/htdocs/owncloud/occ(11): require_once('/srv/www/htdocs...')
#17 {main}
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 2229    | 24219 | 00:00:50     |
+---------+-------+--------------+

btw. i did not find any log-entrys for this (nor in php than in redis)
nextcloud is 16.0.5 (stable)

1 Like

Try to increase the log level for redis. Check perhaps for obvious things like missing RAM/Swap that could kill processes.

Found the redis- issue https://github.com/antirez/redis/issues/1396

Seems like there is a problem with redundant process- names spawning while saving data and some settings in linux cleaning duplicated processes.
In consequence the redis- server got sigterm about every minute forcing it to shutdown (indicated in the logs). This is when the socket went away

The solution is: “Changing supervised no in redis.conf to supervised systemd fixed this issue.”
Leaving this here if anybody has the same problem.

1 Like

For me there were 2 issues keeping that Redis server went away error popping up;
The first one was solved by putting supervised as systemd, like you mentioned, in /etc/redis/redis.conf, the second one was that I was pointing to a false name for the socket.
People like https://www.c-rieger.de/nextcloud-installationsanleitung/#c01publish a wrong socket;
'host' => '/var/run/redis/redis-server.sock',
while it should actually be:
'host' => '/run/redis/redis.sock',
on most debian systems and its derivatives.

I needed to set unixsocketperm to 770 on my home nextcloud server