From b4675736eee8f0a7247fb1308561c509898a848f Mon Sep 17 00:00:00 2001 From: BlankenshipG Date: Tue, 6 Oct 2026 15:18:30 -0400 Subject: [PATCH] fix(engine): always write the heartbeat line regardless of logging level The launcher's wedge watchdog kills a client whose RynthCore..log is silent for 120 s. The hb line went through RynthLog.Info at the General category's level, so LoggingLevel=Info with General=Trace filtered it and healthy in-world clients were killed and relaunched every few minutes. RynthLog.Heartbeat writes unconditionally, like RynthLog.Error. Release 2026.10.5.14. Co-authored-by: Cursor --- ...se-2026.10.5.14-heartbeat-always-logged.md | 45 +++++++++++++++++++ .../Compatibility/HeartbeatLogger.cs | 3 +- src/RynthCore.Engine/RynthLog.cs | 9 ++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 Changelog/2026-10-06-release-2026.10.5.14-heartbeat-always-logged.md diff --git a/Changelog/2026-10-06-release-2026.10.5.14-heartbeat-always-logged.md b/Changelog/2026-10-06-release-2026.10.5.14-heartbeat-always-logged.md new file mode 100644 index 0000000..01080f3 --- /dev/null +++ b/Changelog/2026-10-06-release-2026.10.5.14-heartbeat-always-logged.md @@ -0,0 +1,45 @@ +# RynthCore 2026.10.5.14 — engine heartbeat is always logged + +**Date:** 2026-10-06 +**Branch:** `fix/heartbeat-always-logged` (from `main` 143eaa9); deployed build is the +same fix cherry-picked onto `fix/restore-sk-features` (the 2026.10.5.13 line) +**Previous release:** 2026.10.5.13 (895a63a) +**Component:** `RynthCore.Engine` only (no plugin API change) + +## Problem + +The launcher killed healthy, in-world clients and relaunched them every few minutes +(Silentkelpie and Silentstorm, 2026-10-06 14:46 to 15:13; launcher log lines +`WEDGE: PID … killed - engine heartbeat silent for >120s while process alive`). + +- The launcher's wedge watchdog treats `RynthCore..log` not being written for + 120 s as a dead engine and kills the process. +- The engine's once-a-second heartbeat line (`hb #N … fps= … login= …`) was written + through `RynthLog.Info`, which writes at the **General category's** level. +- With `LoggingLevel = Info` and `General = Trace` (launcher logging settings), the + heartbeat was emitted at Trace and filtered out by the global Info threshold, so the + log went quiet once a character was in-world and the watchdog fired. +- The launcher copies its own `LoggingLevel` into `engine.json` on every launch, so a + hand edit of `engine.json` only lasted until the next relaunch. +- Knock-on effect: relaunches landed while the killed character was still logged in on + the server, and the new client was booted to the end-of-session screen + (`LogOffCharacter(immediate=1)` from `gmEpilogueUI`) about 35 s after launch. + +## Fix + +- New `RynthLog.Heartbeat(string)`: writes unconditionally (every `LoggingLevel`, + including Off), tagged `[INF]`, like `RynthLog.Error` does for errors. +- `HeartbeatLogger` writes the `hb #` line through `RynthLog.Heartbeat`. +- No change to the line format, so every launcher's `WedgeHbRegex` still parses it. + +## Notes + +- The startup warning about categories above the global level stays; it still applies + to every other line. +- Workaround for older engines: set the launcher's global logging level to Trace, or + turn off auto-restart of wedged clients. + +## Files + +- `src/RynthCore.Engine/RynthLog.cs` — `Heartbeat` method. +- `src/RynthCore.Engine/Compatibility/HeartbeatLogger.cs` — heartbeat uses it. diff --git a/src/RynthCore.Engine/Compatibility/HeartbeatLogger.cs b/src/RynthCore.Engine/Compatibility/HeartbeatLogger.cs index 5a37c15..ba24a13 100644 --- a/src/RynthCore.Engine/Compatibility/HeartbeatLogger.cs +++ b/src/RynthCore.Engine/Compatibility/HeartbeatLogger.cs @@ -162,7 +162,8 @@ internal static class HeartbeatLogger // every use/move/equip meanwhile); atk=1 = its attacking flag is set. Both // omitted while open, so a long run of req= in a log is the item-action lock. string gateField = ClientActionGates.HeartbeatField(); - RynthLog.Info($"hb #{tick} up={(nowMs - startMs) / 1000}s fps={fps} draw={draw} plug={pps}/s ws={wsMb}MB login={login} qdrop={dropped} rec={rec} fcl={fcl}{idleField}{uiField}{vaField}{gateField}"); + // Unfiltered on purpose: it is the launcher's liveness signal (see RynthLog.Heartbeat). + RynthLog.Heartbeat($"hb #{tick} up={(nowMs - startMs) / 1000}s fps={fps} draw={draw} plug={pps}/s ws={wsMb}MB login={login} qdrop={dropped} rec={rec} fcl={fcl}{idleField}{uiField}{vaField}{gateField}"); // Every 60 s: garbage collections and the time they paused the process. // Under the CoreCLR host the engine and managed plugins share one GC, so a diff --git a/src/RynthCore.Engine/RynthLog.cs b/src/RynthCore.Engine/RynthLog.cs index 7a97386..a6fd341 100644 --- a/src/RynthCore.Engine/RynthLog.cs +++ b/src/RynthCore.Engine/RynthLog.cs @@ -55,6 +55,15 @@ internal static class RynthLog EntryPoint.LogTagged("engine", msg, "WRN"); } + /// + /// Always-on heartbeat line, written at every LoggingLevel (Off included). The launcher's + /// wedge watchdog reads RynthCore.<pid>.log going quiet for 120 s as a dead engine and + /// kills the client, so this line must never be filtered: on 2026-10-06 LoggingLevel=Info + /// with General=Trace dropped it and healthy in-world clients were killed and relaunched + /// every few minutes. + /// + internal static void Heartbeat(string msg) => EntryPoint.LogTagged("engine", msg, "INF"); + /// Always-on ERROR line — a fault/crash/disable, written even at level Off. Triage with grep "[ERR]". internal static void Error(string msg) {