Open alireza267 opened 8 months ago
Have you ever modified your model in the past and does it follow the extend only design principle?
It might be best to extend the OnRecoveryFailure()
method in your persistence actor and do a dump of the failed message, you can debug the possibly corrupt message from there.
Version Information Version of Akka.NET? 1.5.13 Which Akka.NET Modules? Akka.Persistence.Redis, Akka.Serialization.Hyperion
Describe the bug Rarely, an actor couldn’t get started due to snapshot recovery failure, and this exception occurs:
---> System.Runtime.Serialization.SerializationException: Failed to deserialize object of type [oms.models.ActorSnapshots.UserActorState] from the stream. Cause: Failed to deserialize object of type [System.Collections.Generic.List`1[domain.Entities.OrderBaseEntity]] from the stream. Cause: Failed to deserialize object of type [domain.Entities.OrderSellEntity] from the stream. Cause: Unable to cast object of type 'domain.Entities.TradeItem' to type 'domain.Enums.OrderValidityEnum'.
To Reproduce it's not reproducible.
Expected behavior To Deserialize Snapshot state successfully. This is the State of the actor which is persisted :
Actual behavior Sometimes Failed to recover snapshot state
Environment docker, .net8
Additional context I've configured Hyperion serializer like this:
akka { actor { provider = cluster serializers { hyperion = "Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion" } serialization-bindings { "System.Object" = hyperion } }