Commit graph RynthCore/src/RynthCore.Engine/MainThreadFreeze.cs
Author SHA1 Message Date
Daniel Wallace
55f7497065 Engine robustness: appraisal merge, AutoId re-eligibility, freeze pause, OOM dump, crash logger, transition gate
Appraisals
- RequestId slot merges a pending request for the same object (PendingIdQueue), as the
  QueryHealth slot does.
- AutoId: per-object last-sent time kept across client releases; no re-appraisal within
  10 min while the data is cached, unless the server deleted the object (0xF747). Map
  bounded at 8192 with a prune off the create path. The sent mark is set at the real
  send in DrainRequestIds, not at queue time.
- The selected-target priority appraisal is skipped when its data is cached and fresh.

Main thread frozen
- Plugin ticks pause while AC's main thread is frozen (a main-thread message box, or no
  beat for the hang watchdog's threshold); events keep flowing. Exposed through
  GetEngineStatusJson (mainThreadFrozen, mainThreadStallMs, pluginTicksPausedMs) and the
  heartbeat (pump=paused).

Crashes
- AC's OUT OF MEMORY box: one full-memory dump to <install>\Dumps before the box shows,
  newest 3 kept.
- Native crash logger: pid, tid and date per entry; once per address; .NET Framework
  AVs never charged to the limit; last-chance handler; stack overflow and heap
  corruption codes. Build-SehTrampoline gains -NoDeploy.
- ProcessExitHooks: dead fail-fast detours removed; crash exit codes pass straight
  through TerminateProcess/NtTerminateProcess.
- CoreCLR's own crash dump is left to the loader's existing ConfigureCrashDumps
  (Loader.c, Logs\dumps\clr_*.dmp) and Publish-EngineCoreClr's createdump/DAC
  handling; this change adds no second setup.

World transitions
- AcMainThreadQueue holds queued game-mutating work while the player is dead, in portal
  space, or within 5 s after either or after a non-adjacent landblock jump. When the
  window ends, stale casts, uses, selects and appraisals are dropped and stops and
  cancels run in order. Walking across an adjacent landblock border never gates.
  State is re-sampled after AC's tick, before the post-tick drain.
- Inventory panel actions are held during a transition too.

Diagnostics
- Heartbeat valargest= (largest free VA block); free and largest logged before and after
  each plugin load and unload.
- CastSpell comments corrected to the actual main-thread paths.

Tests
- tools\EngineRobustnessTests and native\SehTrampoline\tests\CrashLogFilterTests.c.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 17:17:59 -07:00