Engine robustness review fixes: crash-log repeats, teardown reserve, mutator gate, OOM dump safety
Native crash logger - Per-address slots keep hit counts and a last-write tick; a repeat relogs at powers of two, after 30 s, or for any non-AV code. The oldest noise slot is evicted when the table is full. - The logger checks its dedupe first, caches the module table, and opens the log handle once at install. Managed-noise bucket (coreclr, clrjit, System.Private.CoreLib). Main-thread queue - The action ring (ActionRing) rejects non-teardown work during a world transition and reserves its top 32 slots for teardown, so a stop is never lost behind held work. IsTeardownKind is shared by the enqueue and drain sides. ActionRing.TryPeekAt lets the cast drain's StopQueuedAtOrBefore walk the ring it no longer owns directly; the walk now checks every queued entry, since an entry's time is taken before the ring's lock. - MutatorGate: every AC-mutating helper opens with the same gate, AcMainThreadQueue.MustQueue(teardown: X); IsDraining and ShouldDefer added; teardown helpers are exempt from the hold. tools\check_offthread_mutators.py accepts MustQueue as the gate (it asks MainThreadGuard.IsOnMainThread itself). - MasteryFeed and VaultFeed pause during a transition. The heading slot drops a stale heading; the overlay select is kept. - RequestId never merges into an entry queued at or before the last transition hold; EnqueueRequestId returns false during a transition. - 0xF751 PlayerTeleport starts the 5 s settle window. - Cast slot: the queue time and Pending are published with Volatile.Write (a plain 64-bit store can tear on x86 and the drain reads both without the lock); the stop-wait flag is reset before the publishing store. Appraisals - Appraisal data survives a client release for 10 min (bounded at 4096); evicted on server delete (0xF747) and at session clear. 0xF747 is detected in SmartBox dispatch, independent of capture. Dumps - Dump start/end markers in the log; the launcher holds its wedge kill while a dump is in progress (DumpInProgressRule). The in-progress flag is cleared only when the writer thread exits. - The OOM dump triggers only on the main thread with AC's exact text, before stacks are built. Dumps are pruned only after a successful write, and other live clients' dumps are kept. CrashDump reads the file length before Delete. - ExitProcess/RtlExitUserProcess detours forward crash codes first. - The message box count is decremented first in a finally; 30 s safety reset when no box is visible on the main thread. - UsageStats counts the loader's CoreCLR fatal-error dumps (Logs\dumps\clr_*.dmp) as crashes alongside crash_*.dmp. Tests: EngineRobustnessTests, CrashLogFilterTests, UsageStatsTests. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
55f7497065
commit
8c7201dc25
41 changed files with 1797 additions and 448 deletions
|
|
@ -371,7 +371,7 @@ internal static class ClientHelperHooks
|
|||
// (every UseObject/MoveItem/cast sibling already marshals). Drain re-invokes
|
||||
// this on the main thread, where the gate is satisfied and it runs directly.
|
||||
// SelectItem() funnels through here, so this one gate covers both.
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueSetSelectedObject(objectId);
|
||||
|
||||
if (_setSelectedObject == null)
|
||||
|
|
@ -400,7 +400,7 @@ internal static class ClientHelperHooks
|
|||
/// </summary>
|
||||
public static bool SelectFromOverlay(uint objectId)
|
||||
{
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueOverlaySelect(objectId);
|
||||
|
||||
if (objectId == 0 || _setSelectedObject == null)
|
||||
|
|
@ -433,7 +433,7 @@ internal static class ClientHelperHooks
|
|||
// main thread (via the OnEndScene drain), not off the pump thread. Off-thread
|
||||
// UseObject mutated AC's animation sequence (CSequence) and corrupted it ->
|
||||
// the CSequence::update_internal AV captured after looting was enabled.
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueUseObject(objectId);
|
||||
|
||||
if (_useObject == null || !IsValidObjectId(objectId))
|
||||
|
|
@ -466,7 +466,7 @@ internal static class ClientHelperHooks
|
|||
// Marshal onto AC's main thread (off-thread use-on-target mutates AC's
|
||||
// object/animation graph and corrupts it — see UseObject). Drain re-invokes
|
||||
// this on the main thread, where the gate is satisfied and it runs directly.
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueUseObjectOn(sourceObjectId, targetObjectId);
|
||||
|
||||
if (_useWithTargetEvent == null || !IsValidObjectId(sourceObjectId) || !IsValidObjectId(targetObjectId))
|
||||
|
|
@ -492,7 +492,7 @@ internal static class ClientHelperHooks
|
|||
|
||||
public static bool UseEquippedItem(uint sourceObjectId, uint targetObjectId)
|
||||
{
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueUseEquippedItem(sourceObjectId, targetObjectId);
|
||||
|
||||
if (_useEquippedItem == null || !IsValidObjectId(sourceObjectId) || !IsValidObjectId(targetObjectId))
|
||||
|
|
@ -517,7 +517,7 @@ internal static class ClientHelperHooks
|
|||
{
|
||||
// Marshal onto AC's main thread — off-thread item moves race AC's per-tick
|
||||
// object/container bookkeeping (the looting null-deref AV class).
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueMoveItemExternal(objectId, targetContainerId, amount);
|
||||
|
||||
if (_moveItemExternal == null || !IsValidObjectId(objectId) || !IsValidContainerId(targetContainerId) || amount < 0)
|
||||
|
|
@ -547,7 +547,7 @@ internal static class ClientHelperHooks
|
|||
|
||||
public static bool MoveItemInternal(uint objectId, uint targetContainerId, int slot, int amount)
|
||||
{
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueMoveItemInternal(objectId, targetContainerId, slot, amount);
|
||||
|
||||
if (_moveItemInternal == null) return false;
|
||||
|
|
@ -604,7 +604,7 @@ internal static class ClientHelperHooks
|
|||
/// </summary>
|
||||
public static bool SplitStackInternal(uint objectId, uint targetContainerId, int slot, int amount)
|
||||
{
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueSplitStackInternal(objectId, targetContainerId, slot, amount);
|
||||
|
||||
if (_moveItemInternal == null) return false;
|
||||
|
|
@ -656,7 +656,7 @@ internal static class ClientHelperHooks
|
|||
/// </summary>
|
||||
public static bool MergeStackInternal(uint sourceObjectId, uint targetObjectId)
|
||||
{
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueMergeStackInternal(sourceObjectId, targetObjectId);
|
||||
|
||||
if (_eventStackableMerge == null) return false;
|
||||
|
|
@ -714,7 +714,7 @@ internal static class ClientHelperHooks
|
|||
/// </summary>
|
||||
public static bool PutItemInContainerAt(uint objectId, uint containerId, int slot)
|
||||
{
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueuePutItemInContainer(objectId, containerId, slot);
|
||||
|
||||
if (_eventPutItemInContainer == null) return false;
|
||||
|
|
@ -749,7 +749,7 @@ internal static class ClientHelperHooks
|
|||
// Marshal onto AC's main thread — off-thread F7B1 inventory sends race AC's
|
||||
// per-tick object/container bookkeeping (the looting null-deref AV class),
|
||||
// exactly like MoveItemExternal / MergeStackInternal.
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueGiveObjectTo(objectId, targetId, amount);
|
||||
|
||||
if (_eventGiveObjectRequest == null) return false;
|
||||
|
|
@ -795,7 +795,7 @@ internal static class ClientHelperHooks
|
|||
public static bool WieldItem(uint objectId, uint equipMask)
|
||||
{
|
||||
// Inventory sends run on AC's main thread, like MoveItemExternal / GiveObjectTo.
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return _eventGetAndWieldItem != null && IsValidObjectId(objectId) && equipMask != 0
|
||||
&& AcMainThreadQueue.EnqueueWieldItem(objectId, equipMask);
|
||||
|
||||
|
|
@ -825,7 +825,7 @@ internal static class ClientHelperHooks
|
|||
public static bool DropItem(uint objectId)
|
||||
{
|
||||
// Inventory sends run on AC's main thread, like WieldItem / GiveObjectTo.
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return _eventDropItem != null && IsValidObjectId(objectId)
|
||||
&& AcMainThreadQueue.EnqueueDropItem(objectId);
|
||||
|
||||
|
|
@ -859,7 +859,7 @@ internal static class ClientHelperHooks
|
|||
public static bool CloseContainer(uint containerId)
|
||||
{
|
||||
// An inventory game-action send, like DropItem / WieldItem: main thread only.
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: true))
|
||||
return _eventNoLongerViewingContents != null && IsValidObjectId(containerId)
|
||||
&& AcMainThreadQueue.EnqueueCloseContainer(containerId);
|
||||
|
||||
|
|
@ -1151,7 +1151,7 @@ internal static class ClientHelperHooks
|
|||
// same class as the SetSelectedObject 0x60D1D AV. The ring is FIFO with
|
||||
// one consumer, so open -> add -> execute keep their order. Drain calls
|
||||
// back into this method on the main thread, where the gate is satisfied.
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueSalvageOpen(toolId);
|
||||
|
||||
try
|
||||
|
|
@ -1193,7 +1193,7 @@ internal static class ClientHelperHooks
|
|||
// queued entry carries only the item id: on the main thread this method
|
||||
// runs again and re-reads the instance, since the panel may have closed
|
||||
// or been rebuilt in between.
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueSalvageAddItem(itemId);
|
||||
|
||||
try
|
||||
|
|
@ -1228,7 +1228,7 @@ internal static class ClientHelperHooks
|
|||
|
||||
// Off-thread: same shape as SalvagePanelAddItem (instance re-read on the
|
||||
// main thread when the entry drains).
|
||||
if (!MainThreadGuard.IsOnMainThread())
|
||||
if (AcMainThreadQueue.MustQueue(teardown: false))
|
||||
return AcMainThreadQueue.EnqueueSalvageExecute();
|
||||
|
||||
try
|
||||
|
|
|
|||
Loading…
Reference in a new issue