-
-
Notifications
You must be signed in to change notification settings - Fork 287
Fix deadlock when multiple key lookups are coalessed and one of them throws an KeyNotFoundException #433
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
Conversation
else | ||
{ | ||
elementMap[v].OnNext(Enumerable.Empty<CacheElement>()); | ||
catch(KeyNotFoundException e) { |
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.
Given you do a ContainsKey() would this ever be hit?
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.
You check resultMap.ContainsKey(v) not true
Then you do a lookup with elementMap[v] with the same key, so yeah. A KeyNotFoundException could happen.
I don't remember the exact details. I just remember that this fix resolves a lot of crashy behaviour in my app on slow phones.
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.
Sorry,
The exception in the issue could have been created further down the reactive observables.
I should have copies the details of the exception back then.
Thanks for the pull request @jorisvergeer know it's been a while but finally in. |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Possible fix for #432
What is the current behavior? (You can also link to an open issue here)
See #432
What is the new behavior (if this is a feature change)?
No deadlock
Does this PR introduce a breaking change?
Possibly when the calling application depends on those deadlocks
Please check if the PR fulfills these requirements
Other information: