fix(engine): always write the heartbeat line regardless of logging level

The launcher's wedge watchdog kills a client whose RynthCore.<pid>.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 <cursoragent@cursor.com>
This commit is contained in:
BlankenshipG 2026-10-06 15:18:30 -04:00
commit b4675736ee
3 changed files with 56 additions and 1 deletions

View file

@ -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.<pid>.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.

View file

@ -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

View file

@ -55,6 +55,15 @@ internal static class RynthLog
EntryPoint.LogTagged("engine", msg, "WRN");
}
/// <summary>
/// Always-on heartbeat line, written at every LoggingLevel (Off included). The launcher's
/// wedge watchdog reads RynthCore.&lt;pid&gt;.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.
/// </summary>
internal static void Heartbeat(string msg) => EntryPoint.LogTagged("engine", msg, "INF");
/// <summary>Always-on ERROR line — a fault/crash/disable, written even at level Off. Triage with grep "[ERR]".</summary>
internal static void Error(string msg)
{