Index | Thread | Search

From:
Rafael Sadowski <rafael@sizeofvoid.org>
Subject:
Re: relayd: fix deferring connections log
To:
tech@openbsd.org
Date:
Sun, 2 Aug 2026 16:19:46 +0200

Download raw body.

Thread
On Sun Aug 02, 2026 at 02:12:09PM +0200, Rafael Sadowski wrote:
> log_debug is so stupid here. This is a real problem, and no user can
> currently find it in the logs (see my other diffs).
> 
> log_debug can only be enabled by using "-v". If you run it as a daemon,
> it isn't visible and your relayd setup has real problems. There are
> other places where we print nothing too, but this one is really
> ridiculous!
> 
> 

I think this is much better to detect a "too many open files..." issue.

OK?

diff --git a/control.c b/control.c
index fb64608..e40ab65 100644
--- a/control.c
+++ b/control.c
@@ -153,6 +153,7 @@ control_accept(int listenfd, short event, void *arg)
 
 			event_del(&cs->cs_ev);
 			evtimer_add(&cs->cs_evt, &evtpause);
+			log_warn("%s: deferring connections", __func__);
 		} else if (errno != EWOULDBLOCK && errno != EINTR &&
 		    errno != ECONNABORTED)
 			log_warn("%s: accept", __func__);
diff --git a/relay.c b/relay.c
index 6992900..3c9f2e8 100644
--- a/relay.c
+++ b/relay.c
@@ -1132,7 +1132,7 @@ relay_accept(int fd, short event, void *arg)
 
 			event_del(&rlay->rl_ev);
 			evtimer_add(&rlay->rl_evt, &evtpause);
-			log_debug("%s: deferring connections", __func__);
+			log_warn("%s: deferring connections", __func__);
 		}
 		return;
 	}
@@ -1573,6 +1573,9 @@ relay_connect_retry(int fd, short sig, void *arg)
  retry:
 	if ((con->se_out.s = relay_socket_connect(&con->se_out.ss,
 	    con->se_out.port, rlay->rl_proto, bnds)) == -1) {
+		if (errno == ENFILE || errno == EMFILE)
+			log_warn("%s: session %d: deferring forward",
+			    __func__, con->se_id);
 		log_debug("%s: session %d: "
 		    "forward failed: %s, %s", __func__,
 		    con->se_id, strerror(errno),
@@ -1695,8 +1698,8 @@ relay_connect(struct rsession *con)
 	if ((con->se_out.s = relay_socket_connect(&con->se_out.ss,
 	    con->se_out.port, rlay->rl_proto, bnds)) == -1) {
 		if (errno == ENFILE || errno == EMFILE) {
-			log_debug("%s: session %d: forward failed: %s",
-			    __func__, con->se_id, strerror(errno));
+			log_warn("%s: session %d: deferring forward",
+			    __func__, con->se_id);
 			evtimer_set(&con->se_inflightevt, relay_connect_retry,
 			    con);
 			event_del(&rlay->rl_ev);