You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GetOrSetAsync call for particular cacheKey sometimes hangs for an infinite time.
I think the reason of the behaviour is thisTaskCompletionSource which can be created, for intance, when 2 threads getting value for a first time in parallel (cache miss), and thread A goes to this branch of code , thread B goes to this branch of code, sleeps for a while, and then calls KeyLock.WaitAsync(cacheKey) when the KeyLock is already released by thread A.
Then, Thread B waits for the TaskCompletionSource just created by itself, and from the thread perspective it looks like infinite call of GetOrSetAsync method, and only another thread calling GetOrSetAsync with the same cacheKey can release Thread B from this block.
Not sure, but it looks like even this another thread call won't help if it happens after cacheEntry (created by thread A) is expired.
How can it be reproduced?
In my case it could only be reproduced under (relatively) heavy load.
Environment (if applicable)
NuGet Package Version: 0.14.0
.NET Runtime Version: .NET 8
Operating System: Linux
The text was updated successfully, but these errors were encountered:
What does the bug do?
GetOrSetAsync
call for particularcacheKey
sometimes hangs for an infinite time.I think the reason of the behaviour is this
TaskCompletionSource
which can be created, for intance, when 2 threads getting value for a first time in parallel (cache miss), and thread A goes to this branch of code , thread B goes to this branch of code, sleeps for a while, and then callsKeyLock.WaitAsync(cacheKey)
when theKeyLock
is already released by thread A.Then, Thread B waits for the
TaskCompletionSource
just created by itself, and from the thread perspective it looks like infinite call ofGetOrSetAsync
method, and only another thread callingGetOrSetAsync
with the samecacheKey
can release Thread B from this block.Not sure, but it looks like even this another thread call won't help if it happens after
cacheEntry
(created by thread A) is expired.How can it be reproduced?
In my case it could only be reproduced under (relatively) heavy load.
Environment (if applicable)
The text was updated successfully, but these errors were encountered: