docker icon indicating copy to clipboard operation
docker copied to clipboard

Redis restarts occasionally - "user requested shutdown"

Open Redsandro opened this issue 4 years ago • 1 comments

I have a docker setup like the one documented in this repo here.

Every couple of weeks or so, my Nextcloud instance goes down. I will receive this message upon opening the webpage:

Warning: Redis::connect(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/lib/private/RedisFactory.php on line 92 Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/lib/private/RedisFactory.php:92) in /var/www/html/lib/private/legacy/OC_Template.php on line 350 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.

In the Docker logs I will see the following. Note the first line:

redis  | 1:signal-handler (1626733932) Received SIGTERM scheduling shutdown...
redis  | 1:M 19 Jul 22:45 # User requested shutdown...
redis  | 1:M 19 Jul 22:45 * Saving the final RDB snapshot before exiting.
redis  | 1:M 19 Jul 22:45 * DB saved on disk
redis  | 1:M 19 Jul 22:45 # Redis is now ready to exit, bye bye...
redis  | 1:C 20 Jul 04:28 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis  | 1:C 20 Jul 04:28 # Redis version=6.2.3, bits=64, commit=00000000, modified=0, pid=1, just started
redis  | 1:C 20 Jul 04:28 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis  | 1:M 20 Jul 04:28 * monotonic clock: POSIX clock_gettime
redis  | 1:M 20 Jul 04:28 * Running mode=standalone, port=6379.
redis  | 1:M 20 Jul 04:28 # Server initialized
redis  | 1:M 20 Jul 04:28 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis  | 1:M 20 Jul 04:28 * Loading RDB produced by version 6.2.3
redis  | 1:M 20 Jul 04:28 * RDB age 50180 seconds
redis  | 1:M 20 Jul 04:28 * RDB memory usage when created 0.90 Mb
redis  | 1:M 20 Jul 04:28 * DB loaded from disk: 0.001 seconds
redis  | 1:M 20 Jul 04:28 * Ready to accept connections

It doesn't happen often and it's easily remedied (just restart the containers), but it still causes people (the dozen or so users of this instance) to complain every month.

Any idea what causes this?

Redsandro avatar Jul 20 '21 16:07 Redsandro

Meanwhile, I've upgraded multiple major versions to Nextcloud 24. I'm having this more often now. Multiple times per day. I forgot I had raised this issue before, and actually found my own issue through duckduckgo.

Warning: Redis::pconnect(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/lib/private/RedisFactory.php on line 137

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/lib/private/RedisFactory.php:137) in /var/www/html/lib/private/legacy/OC_Template.php on line 352 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.

The problem is that Redis quits when Nextcloud makes too many requests or something. But there is hardly enough configuration for mistakes here. The combination of Nextcloud + Redis has proven a bit unreliable on my hardware configuration. Surely I can't be the only one experiencing this problem?

Workaround:

0 * * * * /usr/local/bin/docker-compose -f /var/nextcloud/docker-compose.yml restart redis > /dev/null 2>&1

Redsandro avatar Sep 09 '22 22:09 Redsandro

I can't reproduce this issue. This repo is only for the Nextcloud image, not for Redis.

J0WI avatar Apr 04 '23 17:04 J0WI