Rspamd learning fault due to lacking redis connection

Nethserver 7.6.1810(final)
emclient over imap and carddav (SOGo)

I also tried to get the learn funktion working with no luck. I moved junk mail from inbox to junk folder and got this bounce message:

The mail system

<“guus@ijzereef.nl+learn_spam”@spamtrain.nh>: Command died with status 1:
“/usr/bin/rspamc”. Command output: Results for file: stdin (2.017 seconds)
HTTP error: 1, error getting reply from redis server
/var/run/redis-rspamd/rspamd: No such file or directory

So I searched, found this topic and checked my log files:

imap log:
Jan 9 19:51:34 yz1web dovecot: imap(guus@ijzereef.nl): sieve: pipe action: piped message to program `spam-training’
Jan 9 19:51:34 yz1web dovecot: imap(guus@ijzereef.nl): sieve: left message in mailbox ‘Junk’

maillog:
Jan 9 19:54:41 yz1web rspamd[30096]: <>; ; rspamd_redis_pool_new_connection: cannot connect to redis: No such file or directory
Jan 9 19:54:41 yz1web rspamd[30096]: <>; ; rspamd_lua_redis_prepare_connection: cannot connect to redis: unknown error
Jan 9 19:54:41 yz1web rspamd[30096]: <>; lua; lua_redis.lua:722: cannot execute redis request

redis rspamd log:
empty file

any suggestions how to solve?

systemctl restart redis-rspamd

check if you have the socket

ll /var/run/redis-rspamd/rspamd

1 Like

command gave no remark

command gives following errors:
ll /var/run/redis-rspamd/rspamd
ls: cannot access /var/run/redis-rspamd/rspamd: No such file or directory

should I reinstall redis-rspamd?

Si i tried to install package redis through yum

and now the command gives the expected response:
[root@yz1web ~]# ll /var/run/redis-rspamd/rspamd
srwxrwx— 1 redis mail 0 Jan 11 19:08 /var/run/redis-rspamd/rspamd

Start checking the learning function now.

systemctl status redis-rspamd

and any clues in /var/log/messages & /var/log/maillog

it seemed that redis was not installed

1 Like

probably redis was down, or you removed it…do not know

I gues somehow i removed it. Also the epel repository wasn’t active anymore, I restored that yesterday.
Now the outcom is:

[root@yz1web ~]# systemctl status redis-rspamd
● redis-rspamd.service - Redis persistent key-value database Rspamd
Loaded: loaded (/usr/lib/systemd/system/redis-rspamd.service; static; vendor preset: disabled)
Active: active (running) since Fri 2019-01-11 19:08:23 CET; 2min 55s ago
Main PID: 11348 (redis-server)
CGroup: /system.slice/redis-rspamd.service
└─11348 /usr/bin/redis-server 127.0.0.1:0

Jan 11 19:08:23 yz1web.ijzereef.nl systemd[1]: Started Redis persistent key-value databa…d.
Hint: Some lines were ellipsized, use -l to show in full.
I say thanks, start testing the rspamd learning functionality

1 Like

So the learning function of rspamd over the Junk folder works like a charme.

Do I have to make the redis server autostart? With which command if so?

auto start for redis is enabled I think, check if it is enabled

systemctl status redis

systemctl status redis-rspamd

[root@yz1web ~]# systemctl status redis
● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
└─limit.conf
Active: inactive (dead)
[root@yz1web ~]# systemctl status redis-rspamd
● redis-rspamd.service - Redis persistent key-value database Rspamd
Loaded: loaded (/usr/lib/systemd/system/redis-rspamd.service; static; vendor preset: disabled)
Active: active (running) since Fri 2019-01-11 19:08:23 CET; 15min ago
Main PID: 11348 (redis-server)
CGroup: /system.slice/redis-rspamd.service
└─11348 /usr/bin/redis-server 127.0.0.1:0

Jan 11 19:08:23 yz1web.ijzereef.nl systemd[1]: Started Redis persistent key-value databa…d.
Hint: Some lines were ellipsized, use -l to show in full.

So all seems well, many thanks.

1 Like

yep same output on myserver, it seems good. If you matter you should investigate why redis was removed from your server.

Only thing I can think of is that because it wasn’t working i decided to remove rspamd an reinstall it again. Probably this also removed redis and because the epel repository wasn’t active the new installation of rspamd couldn’t install redis.

Question then offcourse is why and how the epel repository was removed. I can’t remember anything causing this but it must have been some action from my site.

There remains only one problem with redis-rspamd. The service seems to stop frequently. Needs to be restarted almost daily

4 months 16 days ago without restarting the service, no clues immediately why your services stops, you should look in logs why !!!

/var/log/redis/rspamd.log
/var/log/redis/redis.log
/var/log/messages
/var/log/maillog

# systemctl status redis-rspamd
    ● redis-rspamd.service - Redis persistent key-value database Rspamd
       Loaded: loaded (/usr/lib/systemd/system/redis-rspamd.service; enabled; vendor preset: disabled)
       Active: active (running) since Thu 2018-09-06 18:11:37 CEST; 4 months 16 days ago
     Main PID: 22728 (redis-server)
       CGroup: /system.slice/redis-rspamd.service
               └─22728 /usr/bin/redis-server 127.0.0.1:0

    Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

just to add something more, redis is important with rspamd, sure that a lot more features are concerned if redis-rspamd is down

the logfile /var/log/redis/redis.log doesn’t exist.

In /var/log/maillog I got the message of a time out:
Jan 22 19:07:41 yz1web rspamd[7574]: <cb9532>; csession; rspamd_task_process: learn error: error getting reply from redis server /var/run/redis-rspamd/rspamd: timeout … HTTP error: 110, error getting reply from redis server /var/run/redis-rspamd/rspamd: timeout )

I have to dig further

yep what it could be interesting are the errors before and after the service goes down