Skip to content
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

Error from storage provider AdoNetGrainStorage during ReadStateAsync with primitive types #9198

Open
dahermansson opened this issue Oct 22, 2024 · 1 comment

Comments

@dahermansson
Copy link

dahermansson commented Oct 22, 2024

If you has a primivite type as peristent state (IPersistentState<bool>) and write state, then clear stete. ReadState will throw exception:

Exc level 0: System.NullReferenceException: Object reference not set to an instance of an object.
   at Orleans.Storage.AdoNetGrainStorage.ReadStateAsync[T](String grainType, GrainId grainReference, IGrainState`1 grainState) in /_/src/AdoNet/Orleans.Persistence.AdoNet/Storage/Provider/AdoNetGrainStorage.cs:line 275
   at Orleans.Core.StateStorageBridge`1.ReadStateAsync() in /_/src/Orleans.Runtime/Storage/StateStorageBridge.cs:line 85

Seams to be relatet to #7780 and #6580

Steps to Repro:

  1. Configure ADO Grain Storage
  2. Activate a grain with a unique ID and a IPersistentState
  3. call IPersistentState.WriteStateAsync()
  4. call IPersistentState.ClearStateAsync()
  5. call IPersistentState.ReadStateAsync() or
  6. wait for grain deactivation
  7. activate grain with same unique ID

This is common to happend when a ClearState is called and the grain gets deactivated. When a grain i activitate again this error will happend due to a call to ReadState on grain being activated.

Expected Behavior:

Shoud be able to use ReadState after ClearState (as it is in grain activation),
or make it realy clear that primivite types as persistent state is not supported with ADOnet storage provider.

@scalalang2
Copy link
Contributor

scalalang2 commented Oct 26, 2024

This issue also appears to be related to #9165.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants