Skip to content

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

@dahermansson

Description

@dahermansson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions