-
Notifications
You must be signed in to change notification settings - Fork 494
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
Fix for an async deadlock, reported in #758 (and probably #717) #761
Conversation
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there is a way to add a UT to avoid any future regressions
@@ -45,7 +45,7 @@ public ICollection<TKey> Keys | |||
|
|||
public void Set(TKey key, TValue value) | |||
{ | |||
AsyncLazy<TValue> lazyValue = new AsyncLazy<TValue>(() => value, CancellationToken.None); | |||
AsyncLazy<TValue> lazyValue = new AsyncLazy<TValue>(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on how to UT/guard for future changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will TestCluster UT based approach validate it?
https://dotnet.github.io/orleans/Documentation/tutorials_and_samples/testing.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a test that uses AsyncCache
with a single thread scheduler should suffice, without needing to use Orleans at all. I will try to create one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kirankumarkolli I've added the test. Instead of adding a dependency on Orleans I've implemented a simple task scheduler in the Testing project that processes a single task at a time (SingleTaskScheduler
). It can be reused in other tests to confirm the code doesn't deadlock.
I would suggest a code review, during which you could identify other places in the codebase where a task result is obtained in a blocking way (eg. .Result
is called) - those will be potential deadlock spots.
Thanks alot @jkonecki for contribution. |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Thanks alot @jkonecki |
Do you have any ETA for the next release of the NuGet package? |
Resolving an async deadlock caused by
AsyncCache
performing a blocking wait.Type of change
Closing issues
Closes #758 and probably #717