When using Mzinga.LinuxX64 on Ubuntu 22.04 with the engine option "Ponder During Idle" set to "Multi Threaded", an intermittent error occurs in the FixedCache.TryLookup method. The error message states, "Object reference not set to an instance of an object", suggesting that a null reference is being accessed. This happens sporadically, likely due to concurrent access by multiple threads.
Error message (using Debug mode):
err Object reference not set to an instance of an object.
at Mzinga.Core.FixedCache2.TryLookup(TKey key, TEntry& entry) in /home/abstrato/work/git/Mzinga/src/Mzinga/Core/FixedCache.cs:line 119
at Mzinga.Core.AI.GameAI.CalculateBoardScore(Board board) in /home/abstrato/work/git/Mzinga/src/Mzinga/Core/AI/GameAI.cs:line 686
at Mzinga.Core.AI.GameAI.QuiescenceSearchAsync(Board board, Int32 depth, Double alpha, Double beta, Int32 color, CancellationToken token) in /home/abstrato/work/git/Mzinga/src/Mzinga/Core/AI/GameAI.cs:line 622
I used a lock (_storeLock) around the TryLookup method to ensure thread safety, similar to other methods in the same class. After applying this fix, the error stopped occurring during my testing, even after several games.
When using
Mzinga.LinuxX64
on Ubuntu 22.04 with the engine option "Ponder During Idle" set to "Multi Threaded", an intermittent error occurs in theFixedCache.TryLookup
method. The error message states, "Object reference not set to an instance of an object", suggesting that anull
reference is being accessed. This happens sporadically, likely due to concurrent access by multiple threads.Error message (using Debug mode):
I used a
lock (_storeLock)
around theTryLookup
method to ensure thread safety, similar to other methods in the same class. After applying this fix, the error stopped occurring during my testing, even after several games.