-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemoryCacheSetAndRemoveTests.AddAndReplaceEntries_AreThreadSafe failed #50270
Comments
Tagging subscribers to this area: @eerhardt, @maryamariyan, @michaelgsharp Issue Details
|
This test sets a small max size then adds lots of items quickly so it stresses compaction. Compaction is by QUWI
the test only gives it 7 seconds to run https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Caching.Memory/tests/MemoryCacheSetAndRemoveTests.cs#L637 after which it sums the sizes of the items (non atomically) and compares with the cache's declared size. However in this case, we summed the sizes of the individual entries and they came to zero, sizes are non negative so this means that if further entries (if any) are removed, the size cannot go up. Yet we then retrieved a Note there is also non determinism from Expiration, which is performed on a Task, and this test sets it to run every possible time. When compaction runs, it marks entries it plans to remove as expired; when remove runs, it also marks them as expired. There is also another Task started in ExpirationTokensExpired but I think (?) that isn't involved in this test. |
It might be necessary to loop the test with some tracing to figure this out. In any case, the test is fragile as is, eg., if it fails because of compaction not being complete, it could wait 30 seconds and check again. That might also fix/mask whatever this issue is. |
Incidentally I wonder whether there are some more debug-only correctness asserts we should add into MemoryCache, because it's difficult to prove its correctness by just reading it (at least for me) |
There are many other reports in issues I duped against this. I see eg it's falling 0.03% of Alpine runs alone so significantly more PRs will be affected |
This test should be disable meantime.. |
OK, closing as dupe of #50270 |
@danmoseley - you are closing this as a dupe of itself? |
Oops, I meant #33993 |
https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-50230-merge-2811b66060e14db5bc/Microsoft.Extensions.Caching.Memory.Tests/console.29893e8c.log?sv=2019-07-07&se=2021-04-15T01%3A34%3A28Z&sr=c&sp=rl&sig=ikZz%2Fo9JRruRy5gBk1P0IeEpuYpzmcQqzCcp%2B3fntRk%3D
The text was updated successfully, but these errors were encountered: