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>
This commit is contained in:
Daniel Wallace 2026-10-10 20:46:37 -07:00
commit 55f7497065
30 changed files with 2202 additions and 419 deletions

View file

@ -146,10 +146,13 @@ internal static class ManagedPlugins
if (retired.Contains(kv.Value)) Loaded.Remove(kv.Key);
}
#if ENGINE_CORECLR
string vaBefore = retired.Count > 0 ? Compatibility.AddressSpace.Describe() : "";
foreach (Entry e in retired)
e.Context.Unload();
// Context.Unload only starts the collection; "after" is right after the request, so the
// NEXT reload's "va before" is where a context that never collects shows up.
if (retired.Count > 0)
RynthLog.Plugin($"ManagedPlugins: {retired.Count} plugin context(s) unloading: {string.Join(", ", retired.ConvertAll(e => e.Name))}.");
RynthLog.Plugin($"ManagedPlugins: {retired.Count} plugin context(s) unloading: {string.Join(", ", retired.ConvertAll(e => e.Name))} (va before: {vaBefore}, after: {Compatibility.AddressSpace.Describe()}).");
#endif
}

View file

@ -1028,6 +1028,13 @@ internal static partial class PluginManager
if (UiFlowHooks.ClientCleanupStarted)
return;
// AC's main thread is frozen (a message box open on it, or no beat for the hang
// watchdog's threshold): no plugin Tick this pump tick, so plugins neither decide nor
// act against a client that cannot run anything (MainThreadFreezeRule.cs). Events keep
// flowing (ProcessPendingActions), and the Nav3D frame is left as it was.
if (MainThreadFreeze.ShouldPausePluginTick())
return;
// Fire the delayed login self-identify once AC's vitals UI has settled
// (armed in DispatchLoginCompleteToLoadedPlugins; deferred past the
// early-init window where AC's gmVitalsUI::Update AV'd — 2026-06-09).
@ -2387,8 +2394,11 @@ internal static partial class PluginManager
continue;
}
RynthLog.Plugin($"PluginManager: Loading extra plugin: {dllPath}");
// Address space before and after each load: a 32-bit client runs out on the largest
// free block, and a reload stacks copies (Compatibility/AddressSpace.cs).
RynthLog.Plugin($"PluginManager: Loading extra plugin: {dllPath} (va before: {Compatibility.AddressSpace.Describe()})");
var plugin = PluginLoader.LoadSingle(dllPath, _shadowRootDir, _loadGeneration);
RynthLog.Plugin($"PluginManager: loaded {Path.GetFileName(dllPath)}{(plugin == null ? " (FAILED)" : "")} (va after: {Compatibility.AddressSpace.Describe()})");
if (plugin != null)
{
plugin.Manifest = manifest;
@ -2552,7 +2562,9 @@ internal static partial class PluginManager
// v71: its script windows close (their placement is kept).
ScriptWindowRegistry.DropOwner(plugin);
string vaBefore = Compatibility.AddressSpace.Describe();
PluginLoader.Unload(plugin);
RynthLog.Plugin($"PluginManager: unloaded {plugin.DisplayName} (va before: {vaBefore}, after: {Compatibility.AddressSpace.Describe()})");
}
_plugins.Clear();