Possible race conditions in Orleans.GrainDirectory.AzureStorage
- Dominant language
- C#
- Stars
- 10.9k
- Forks
- 2.1k
- Avg merge
- 13h 56m
- Merged PRs (30d)
- 351
Description
Upon inspecting the `Orleans.GrainDirectory.AzureStorage` code, I suspect there are two race conditions:
1. The `Register` method attempts to write the table and if that fails, invokes the `Lookup` method, returning what `Lookup` returned. However, I imagine it is possible that the entry in the database that prevented the write operation could be deleted before the `Lookup` method is invoked; in which case, the `Lookup` method would return `null`, and the `Register` method would then return `null`. I assume that would be problematic.
2. The `Unregister` method attempts to read the entry from the database and if one is found, checks if the activation ID is as expected and if so, invokes a `Delete` operation, which I believe will throw an exception if the record doesn't exist or its e-tag doesn't match. Therefore, if another thread/silo unregisters the entry concurrently, that thread could delete the entry from the database, causing the deletion to fail and throw an exception. I assume that would also be problematic.
Contributor guide
Assessment
This issue has not been assessed yet.