+12 August 2022: Wouter
+ - Fix to log accept error ENFILE and EMFILE errno, but slowly, once
+ per 10 seconds. Also log accept failures when no slow down is used.
+
5 August 2022: Wouter
- Fix #734 [FR] enable unbound-checkconf to detect more (basic)
errors.
struct ub_event* slow_accept;
/** true if slow_accept is enabled */
int slow_accept_enabled;
+ /** last log time for slow logging of file descriptor errors */
+ time_t last_slow_log;
};
/**
struct timeval tv;
verbose(VERB_ALGO, "out of file descriptors: "
"slow accept");
+ ub_comm_base_now(b);
+ if(b->eb->last_slow_log+SLOW_LOG_TIME <=
+ b->eb->secs) {
+ b->eb->last_slow_log = b->eb->secs;
+ log_err("accept failed, slow down "
+ "accept for %d msec: %s",
+ NETEVENT_SLOW_ACCEPT_TIME,
+ sock_strerror(errno));
+ }
b->eb->slow_accept_enabled = 1;
fptr_ok(fptr_whitelist_stop_accept(
b->stop_accept));
/* we do not want to log here,
* error: "event_add failed." */
}
+ } else {
+ log_err("accept, with no slow down, "
+ "failed: %s", sock_strerror(errno));
}
return -1;
}
/** timeout to slow accept calls when not possible, in msec. */
#define NETEVENT_SLOW_ACCEPT_TIME 2000
+/** timeout to slow down log print, so it does not spam the logs, in sec */
+#define SLOW_LOG_TIME 10
/**
* A communication point dispatcher. Thread specific.