Hi,

I've send a bug report in bugs@ with subject "relayd crashing some times"

After I disable all hosts from a redirect, I get random fatal() error from check_tables() like the one bellow:

pfe: check_table: cannot get table stats for dir-sieve@relayd/dir-sieve: No such file or directory

Even running with debug I can't find why the table is missing. kill_tables() is not being called from relayd. Don't know if some other part of pf is messing with the tables. I don't have access to them with pfctl, apart from pfctl -vsA where I see the specific redirect/table missing after the error.

I can't find a consistent way to reproduce it, but maybe statistics could be disabled when redirects or tables are down or empty.

The following disables statistics updating when redirect is disabled and when table is either disabled or all hosts in table are disabled. It does not solve the problem of the missing table(s) but at least don't go the fatal path in that case...

Index: pfe.c
===================================================================
RCS file: /cvs/src/usr.sbin/relayd/pfe.c,v
retrieving revision 1.90
diff -u -p -r1.90 pfe.c
--- pfe.c       14 Sep 2020 11:30:25 -0000      1.90
+++ pfe.c       5 Jul 2023 20:59:41 -0000
@@ -790,8 +790,12 @@ pfe_statistics(int fd, short events, voi
        getmonotime(&tv_now);
TAILQ_FOREACH(rdr, env->sc_rdrs, entry) {
-               cnt = check_table(env, rdr, rdr->table);
-               if (rdr->conf.backup_id != EMPTY_TABLE)
+               if (rdr->conf.flags & F_DISABLE)
+                       continue;
+               if (!(rdr->table->conf.flags & F_DISABLE) && rdr->table->up > 0)
+                       cnt = check_table(env, rdr, rdr->table);
+               if (rdr->conf.backup_id != EMPTY_TABLE && !(rdr->backup->conf.flags & 
F_DISABLE) &&
+                   rdr->backup->up > 0)
                        cnt += check_table(env, rdr, rdr->backup);
resethour = resetday = 0;

Reply via email to