Recovering SnapshotOffer cause System.FormatException
Closed this issue · 2 comments
Jeka-Vasiliev commented
We saving snapshots this way
SaveSnapshot(GetDeliverySnapshot());
It serialized as:
{
"_id" : "DeliverToDeviceActor_10",
"PersistenceId" : "DeliverToDeviceActor",
"SequenceNr" : NumberLong(10),
"Timestamp" : NumberLong(636892944877948589),
"Snapshot" : {
"_t" : "Akka.Persistence.AtLeastOnceDeliverySnapshot, Akka.Persistence",
"CurrentDeliveryId" : NumberLong(5),
"UnconfirmedDeliveries" : [
{
"DeliveryId" : NumberLong(5),
"Destination" : {
"_t" : "ChildActorPath"
},
"Message" : {
"_t" : "Dodo.LabelPrinter.Domain.Messages.ReliableDeliveryLabel, Dodo.LabelPrinter.Domain",
"DeliveryId" : NumberLong(5),
"Label" : {
"PizzeriaId" : "7085C24375A3B98911E9509E612E01E4",
"Label" : {
"_id" : LUUID("00009543-5d32-ff00-f16d-08d6b2c2462c"),
"Body" : {
"Number" : 0,
"BoxQuantity" : 0,
"ProductName" : "pepperoni"
}
}
}
}
}
]
}
}
When recover occurs:
Persistence failure when replaying events for persistenceId [DeliverToDeviceActor]. Last known sequence number [0]
System.FormatException: An error occurred while deserializing the Snapshot property of class Akka.Persistence.MongoDb.Snapshot.SnapshotEntry: An error occurred while deserializing the UnconfirmedDeliveries property of class Akka.Persistence.AtLeastOnceDeliveryS
napshot: An error occurred while deserializing the Destination property of class Akka.Persistence.UnconfirmedDelivery: Cannot create an abstract class. ---> System.FormatException: An error occurred while deserializing the UnconfirmedDeliveries property of clas
s Akka.Persistence.AtLeastOnceDeliverySnapshot: An error occurred while deserializing the Destination property of class Akka.Persistence.UnconfirmedDelivery: Cannot create an abstract class. ---> System.FormatException: An error occurred while deserializing the
Destination property of class Akka.Persistence.UnconfirmedDelivery: Cannot create an abstract class. ---> System.MemberAccessException: Cannot create an abstract class.
at System.Runtime.Serialization.FormatterServices.nativeGetUninitializedObject(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetUninitializedObject(Type type)
at lambda_method(Closure )
at MongoDB.Bson.Serialization.BsonClassMap.CreateInstance()
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize(IBsonSerializer serializer, BsonDeserializationContext context)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
--- End of inner exception stack trace ---
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
at MongoDB.Bson.Serialization.Serializers.EnumerableSerializerBase`2.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize(IBsonSerializer serializer, BsonDeserializationContext context)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
--- End of inner exception stack trace ---
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.Serializers.ObjectSerializer.DeserializeDiscriminatedValue(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.Serializers.ObjectSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at Akka.Persistence.MongoDb.FullTypeNameObjectSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize(IBsonSerializer serializer, BsonDeserializationContext context)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
--- End of inner exception stack trace ---
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context)
at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
at MongoDB.Bson.Serialization.Serializers.ProjectingDeserializer`2.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
at MongoDB.Driver.Core.Operations.CursorBatchDeserializationHelper.DeserializeBatch[TDocument](RawBsonArray batch, IBsonSerializer`1 documentSerializer, MessageEncoderSettings messageEncoderSettings)
at MongoDB.Driver.Core.Operations.FindCommandOperation`1.CreateCursorBatch(BsonDocument commandResult)
at MongoDB.Driver.Core.Operations.FindCommandOperation`1.CreateCursor(IChannelSourceHandle channelSource, BsonDocument commandResult, Boolean slaveOk)
at MongoDB.Driver.Core.Operations.FindCommandOperation`1.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Operations.FindOperation`1.ExecuteAsync(IReadBinding binding, CancellationToken cancellationToken)
at MongoDB.Driver.OperationExecutor.ExecuteReadOperationAsync[TResult](IReadBinding binding, IReadOperation`1 operation, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl`1.ExecuteReadOperationAsync[TResult](IClientSessionHandle session, IReadOperation`1 operation, ReadPreference readPreference, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)
at MongoDB.Driver.IAsyncCursorSourceExtensions.FirstOrDefaultAsync[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)
at Akka.Util.Internal.AtomicState.CallThrough[T](Func`1 task)
at Akka.Util.Internal.AtomicState.CallThrough[T](Func`1 task)
Aaronontheweb commented
Related: #53
Aaronontheweb commented
Resolved via #71