RSPAMD Error log: connection to redis server timed out

Discussion in 'General' started by progressed36, Mar 27, 2020.

  1. progressed36

    progressed36 Member

    IM using rspamd now for a good 1,5 month and am very happy with it. I do however get random errors in the log about a connection time out to redis.

    Time    Worker type    PID    Module    Internal ID    Message
    3/27/2020, 9:49:41 AM    normal    6179    task    b51bef    connection to redis server timed out
    I tried to make sense of this. Maybe it is a particular type of email like newsletters or attachements but no. These are just random.
    Im hoping someone else HAD the same problem.

  2. elmacus

    elmacus Active Member HowtoForge Supporter

    Yes, as redis fill up, you will get more of these.
    If you restart redis, do you get any errors ?
    You probably get 3 things you need to fix:
    # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
    # 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.
    # 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.
    nano /etc/sysctl.conf
    vm.overcommit_memory = 1
    nano /etc/rc.local
    echo never > /sys/kernel/mm/transparent_hugepage/enabled
    chmod +x /etc/rc.local
    sysctl vm.overcommit_memory=1
    sysctl -w net.core.somaxconn=512
    echo never > /sys/kernel/mm/transparent_hugepage/enabled
    systemctl restart redis.service
    systemctl restart rspamd.service
    You probably also want to limit background saves, this advice might be wrong but work for me:
    nano /etc/redis/redis.conf
    #add save 87000 10 (one a day) and uncomment the three other values for save
    save 87000 10
    (restart again)
    Keep an eye of your bg file, it will grow beyond sane size after a while.
    ls -lah /var/lib/redis/
    DO NOT DO THESE CHANGES on my word only, im not an expert on Redis, your server might break, wait for what others have to say.
    Check again for errors in Redis.
    There is probaby more to fix as Redis is complex.
    Last edited: Mar 27, 2020
    Jesse Norell likes this.
  3. progressed36

    progressed36 Member

    I did not try above. I did solve it with another workaround.
    As i work in a multiserver enviroment i also have a dedicated mysql server. Now its a dedicated database server as i installed redis-server there and pointed my rspamd configs towards that server. No more timeouts.

Share This Page