From 40d868f4cfa39d9e4edd2da0b0c855fff8f26b14 Mon Sep 17 00:00:00 2001 From: reverse Date: Fri, 14 Aug 2026 14:07:59 +0000 Subject: [PATCH] =?UTF-8?q?liveness:=20probe=20with=20a=20pre-registration?= =?UTF-8?q?=20PING/PONG=20instead=20of=20a=20full=20NICK/USER=20register?= =?UTF-8?q?=20=E2=80=94=20proves=20acceptor+core=20liveness=20without=20cr?= =?UTF-8?q?eating=20a=20client=20session,=20so=20it=20no=20longer=20spams?= =?UTF-8?q?=20the=20snotice=20stream=20with=20livecheck=20connect/quit=20n?= =?UTF-8?q?otices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/liveness.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/liveness.sh b/scripts/liveness.sh index 451fdfb..cfcc90a 100755 --- a/scripts/liveness.sh +++ b/scripts/liveness.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash -# echoIRCd liveness probe: do a real NICK/USER register round-trip on the plaintext -# port and, if the daemon doesn't answer with a 001 welcome, restart it. Catches a -# hung core (process alive but not serving), which Restart=on-failure alone can't. -# Run by echoircd-liveness.timer. +# echoIRCd liveness probe: prove the acceptor + core are alive and responsive with a +# pre-registration PING/PONG round-trip, and restart the daemon if it doesn't answer. +# Catches a hung core (process alive but not serving), which Restart=on-failure can't. +# +# It deliberately does NOT register (no NICK/USER), so it never triggers connect/quit +# server-notices — the probe is invisible in the oper snotice stream. Run by +# echoircd-liveness.timer. set -u PORT="${1:-6767}" @@ -12,7 +15,8 @@ port = int(sys.argv[1]) try: s = socket.create_connection(("127.0.0.1", port), timeout=5) s.settimeout(5) - s.sendall(b"NICK livecheck\r\nUSER lc 0 * :liveness\r\n") + # a pre-registration PING is answered with a PONG, without creating a client session + s.sendall(b"PING :liveness\r\n") data = b"" end = time.time() + 6 while time.time() < end: @@ -20,14 +24,10 @@ try: if not d: break data += d - if b" 001 " in data: + if b"PONG" in data: break - try: - s.sendall(b"QUIT :liveness\r\n") - except OSError: - pass s.close() - sys.exit(0 if b" 001 " in data else 1) + sys.exit(0 if b"PONG" in data else 1) except OSError: sys.exit(1) PY @@ -35,5 +35,5 @@ then exit 0 fi -echo "echoircd liveness: no 001 from 127.0.0.1:${PORT} within timeout — restarting echoircd-dev.service" +echo "echoircd liveness: no PONG from 127.0.0.1:${PORT} within timeout — restarting echoircd-dev.service" systemctl restart echoircd-dev.service