You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "paulirwin (via GitHub)" <gi...@apache.org> on 2026/10/20 15:51:59 UTC
Re: [I] Investigate `TestDirectoryTaxonomy.TestConcurrency()` rare test failure [lucenenet]
paulirwin commented on issue #1444:
URL: https://github.com/apache/lucenenet/issues/1444#issuecomment-6295039934
Found the cause with the help of Claude Code. FacetLabel and CategoryPath have `Int64HashCode()` methods that call `string.GetHashCode()`, which in modern .NET is randomized per process. Can reliably reproduce by forcing the test to pick the LruTaxonomyWriterCache (which normally is picked only ~30% of the time) and running repeated runs in a loop (failed at run 347 on my machine). It fails when the last component's 32-bit string hash collides, which is a birthday problem with a random failure rate of ~3.5% per process, and label `a` has to still be cached when `b` is looked up. Since `string.GetHashCode()`'s randomization is not affected by our random seed, we can't control that behavior with a fixed seed to reproduce.
Switching the methods to use J2N's `CharSequenceComparer.Ordinal.GetHashCode(string)` results in a stable hash code, fixing the issue.
PR incoming once I stress-test this to ensure there are no other failures.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org