State inconsistency bug in orleans/Chirper/Chirper.Grains/ChirperAccount.cs
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 5.1k
- Avg merge
- 9h 11m
- Merged PRs (30d)
- 1
Description
https://github.com/dotnet/samples/blob/main/orleans/Chirper/Chirper.Grains/ChirperAccount.cs
`FollowUserIdAsync` and `UnfollowUserIdAsync` may not interleave, but the grain is reentrant. Interleaving can cause 2 problems if both methods get called with the same username on the same grain:
1. If a user gets followed, but between the remote and local update, he gets unfollowed, the local state says the user is followed, but the remote state says the user is not followed. Same vice versa.
2. The follow and unfollow commands may arrive on the other grain in reverse of sending order, causing the same inconsistencies.
I don't see a way to keep the grain fully reentrant, which is unfortunate, because this is supposed to be a demonstration for reentrant grains: https://learn.microsoft.com/en-us/samples/dotnet/samples/orleans-chirper-social-media-sample-app/
Contributor guide
Research direction
Start in orleans/Chirper/Chirper.Grains/ChirperAccount.cs by tracing FollowUserIdAsync and UnfollowUserIdAsync, then review the linked Orleans Chirper documentation for the reentrant-grain context. Done means concurrent follow and unfollow operations for the same username leave local and remote state consistent and preserve command ordering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100