OrleansContrib / Orleans.Sagas

A distributed saga implementation for Orleans
MIT License
150 stars 28 forks source link

Breaking change after upgrade to 0.36-pre #44

Closed majdee closed 3 years ago

majdee commented 3 years ago

We see a lot of exceptions ( see below) after upgrading the package to 0.36-pre.

It seems the root cause of it is adding the Error dictionary to SagaState, and it fails to deserialize for some reason.

Is there a way if we fail in reading the state, simple clear the current state and re-run all the saga from the beginning?

{"details":[{"typeName":"Orleans.Runtime.OrleansException","message":"Error from storage provider AzureTableGrainStorageWorkaround.Orleans.Sagas.SagaGrain during ReadState for grain Type=Orleans.Sagas.SagaGrain Pk=*grn/C58D5186/4da9b429547bbef528949e34d6df55a803ffffffc58d5186-0xB1040B2D Id=GrainReference:*grn/C58D5186/d6df55a8 Error=\n \nExc level 0: System.AggregateException: Unable to convert from storage format GrainStateEntity.Data=System.Byte[] (Unable to cast object of type 'System.Boolean' to type 'System.Collections.Generic.Dictionary2[System.Type,Orleans.Sagas.SagaError]'.)\n at Orleans.Storage.AzureTableGrainStorage.ConvertFromStorageFormat(DynamicTableEntity entity, Type stateType)\n at Orleans.Storage.AzureTableGrainStorage.ReadStateAsync(String grainType, GrainReference grainReference, IGrainState grainState)\n at Orleans.Core.StateStorageBridge1.ReadStateAsync()\nExc level 1: System.InvalidCastException: Unable to cast object of type 'System.Boolean' to type 'System.Collections.Generic.Dictionary2[System.Type,Orleans.Sagas.SagaError]'.\n at SagaStateDeserializer(Type , IDeserializationContext )\n at Orleans.Serialization.SerializationManager.DeserializeInner[TContext,TReader](SerializationManager sm, Type expected, TContext context, TReader reader)\n at Orleans.Serialization.SerializationManager.DeserializeInner[T](IDeserializationContext context)\n at Orleans.Storage.AzureTableGrainStorage.ConvertFromStorageFormat(DynamicTableEntity entity, Type stateType)"},{"typeName":"System.AggregateException","message":"Unable to convert from storage format GrainStateEntity.Data=System.Byte[] (Unable to cast object of type 'System.Boolean' to type 'System.Collections.Generic.Dictionary2[System.Type,Orleans.Sagas.SagaError]'.)"},{"typeName":"System.InvalidCastException","message":"Unable to cast object of type 'System.Boolean' to type 'System.Collections.Generic.Dictionary2[System.Type,Orleans.Sagas.SagaError]'."}]}`

System.InvalidCastException: Unable to cast object of type 'System.Boolean' to type 'System.Collections.Generic.Dictionary2[System.Type,Orleans.Sagas.SagaError]'. at SagaStateDeserializer(Type , IDeserializationContext ) at Orleans.Serialization.SerializationManager.DeserializeInner[TContext,TReader](SerializationManager sm, Type expected, TContext context, TReader reader) at Orleans.Serialization.SerializationManager.DeserializeInner[T](IDeserializationContext context) at Orleans.Storage.AzureTableGrainStorage.ConvertFromStorageFormat(DynamicTableEntity entity, Type stateType)`