State inconsistency bug in orleans/Chirper/Chirper.Grains/ChirperAccount.cs

Open
#7,124 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp

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.

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/

Dominant language
C#
Stars
3.7k
Forks
5.1k
Avg merge
8m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/samples

All issues in dotnet/samples

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.