Skip to content

Commit 3866170

Browse files
debug(audience): log every DiskStore counter mutation (SDK-341 trace)
Temporary instrumentation. Logs to Player.log: - ctor initial count + dir + instance hash - every BumpCount delta + new value + stack trace + instance hash Goal: identify which call sites fire BumpCount(-1) without matching BumpCount(+1) in the StatusBar_QueueSizeIncrementsAfterTrack failing on Linux Unity 6 cells. Revert before merge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3420c12 commit 3866170

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Packages/Audience/Runtime/Transport/DiskStore.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ internal DiskStore(string persistentDataPath)
2626
_queueDir = Path.Combine(persistentDataPath, "imtbl_audience", "queue");
2727
Directory.CreateDirectory(_queueDir);
2828
_cachedCount = Directory.GetFiles(_queueDir, "*.json").Length;
29+
// DEBUG SDK-341: trace counter init.
30+
UnityEngine.Debug.Log($"[DiskStore] ctor initial count={_cachedCount} dir={_queueDir} hash={GetHashCode()}");
2931
}
3032

3133
// Atomically writes json as a new event file.
@@ -113,7 +115,13 @@ internal void Delete(IEnumerable<string> paths)
113115
// count seeded at construction; mutating ops maintain it.
114116
internal int Count() => Volatile.Read(ref _cachedCount);
115117

116-
private void BumpCount(int delta) => Interlocked.Add(ref _cachedCount, delta);
118+
// DEBUG SDK-341: log every counter mutation with stack so we can see
119+
// who decrements without a matching increment. Revert before merge.
120+
private void BumpCount(int delta)
121+
{
122+
var newValue = Interlocked.Add(ref _cachedCount, delta);
123+
UnityEngine.Debug.Log($"[DiskStore] BumpCount({delta:+#;-#;0}) -> {newValue} hash={GetHashCode()}\n{System.Environment.StackTrace}");
124+
}
117125

118126
private static bool TryDelete(string path)
119127
{

0 commit comments

Comments
 (0)