Error connecting to Redis

When I try to start discourse, I can’t access it in my browser. I found some information in the log files which might cause this. Does somebody know what the problem is?

# /var/discourse/standalone/log/rails/unicorn.stderr.log
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 2 Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:362:in `rescue in establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:343:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:106:in `block in connect'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:306:in `with_reconnect'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:105:in `connect'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:381:in `ensure_connected'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:231:in `block in process'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:319:in `logging'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:230:in `process'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:139:in `block in call_loop'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:292:in `with_socket_timeout'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:138:in `call_loop'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/subscribe.rb:43:in `subscription'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/subscribe.rb:12:in `subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis.rb:3467:in `_subscription'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis.rb:2300:in `block in subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis.rb:52:in `block in synchronize'", "/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis.rb:52:in `synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis.rb:2299:in `subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.3/lib/message_bus/backends/redis.rb:287:in `global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.3/lib/message_bus.rb:721:in `global_subscribe_thread'", "/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.3/lib/message_bus.rb:669:in `block in new_subscriber_thread'"]
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 3 Job exception: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL)
# /shared/standalone/log/var-log/redis/current
40:M 11 Dec 2019 17:46:24.868 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
40:M 11 Dec 2019 17:46:24.868 # Server initialized
40:M 11 Dec 2019 17:46:24.868 # 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.
40:M 11 Dec 2019 17:46:24.868 # 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.
40:M 11 Dec 2019 17:46:24.885 * DB loaded from disk: 0.017 seconds
40:M 11 Dec 2019 17:46:24.891 * Ready to accept connections

If those very long log lines are too hard to read on here, I’ve also put them up on hasteb.in: hastebin

1 Like

Something strange is going on here. I recommend upgrading docker, rebooting your server and rebuilding discourse.

Sucessfully upgraded Docker using apt upgrade docker (it wasn’t the newest version), rebooted Server via reboot, rebuilt using ./launcher rebuild app (got some redis warnings while rebuildings, but they are mostly the same as in the var-log/redis/current file), but I still can’t access my site. I tried accessing accessing it via apache2 as a Proxy (ProxyPass) which gives me a 503 Error and through the ip and the http port (I’ve disabled HTTPS) which just gives me an “ERR_CONNECTION_REFUSED” error from my browser.
This time the unicorn.stderr.log just outputs the following:

I, [2019-12-12T11:58:37.378657 #70]  INFO -- : Refreshing Gem list
I, [2019-12-12T11:58:56.751681 #70]  INFO -- : listening on addr=127.0.0.1:3000 fd=9
I, [2019-12-12T11:59:04.682642 #70]  INFO -- : master process ready
I, [2019-12-12T11:59:23.890076 #172]  INFO -- : worker=0 ready
I, [2019-12-12T11:59:24.852000 #179]  INFO -- : worker=1 ready

and the redis current file still outputs the warnings like before.

Does nobody have a solution for this? I still haven’t found a way to fix this.

It’s nothing obvious. What about /var/discourse/shared/standalone/logs/rails/production.log (if I can type)?

There is no logs Folder inside of shared.

It’s log instead of logs. You gonna have to help us to help you…

2 Likes

The production.log File is just empty.

And I still haven’t found a way to fix this yet. I’ve also been talking to some Forum Admins using Discourse and nobody I found seems to have had this issue.