-
Notifications
You must be signed in to change notification settings - Fork 44
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
PersistenceLifecycleEvent not sent to typed actor #141
Comments
In your test, your actor uses messages of type Unfortunately, F# doesn't offer (untagged) type unions, so the only way for that is to define actor body via |
While the deserialization problem can be solved by e.g. an |
@Horusiath Here is a (somewhat verbose) test to demonstrate the discrepancy: Yakimych@ad12da9 When I run the test for the untyped actor in Debug mode, I can see the following events logged:
The test fails on the last assert, since the state is 0 and 99 has not been restored, but there is no crash - the actor is running with incorrect state. In the test for the typed actor, however, the actor crashes and the test hangs when running Is there any reason the typed and untyped actors behave differently? NOTE: The Sqlite persistence plugin is used for those tests. |
From what I see, you're using Json.NET for persistence - this may be the reason, when trying to deserialize json payload into This is continuous problem of using JSON.NET, and one of the reasons why we started using Hyperion - but problem with Hyperion is that it's binary format is not stabilized and it doesn't provide any guarantees, that future version will keep it backwards compatible. |
You are right! After debugging a bit deeper, I can see that an exception is thrown in the
I can also see that I was also confused as to why the untyped actor doesn't end up along the same path, but I am guessing that As to the serialization problem, I've seen those issues from 2015, but it seemed as they were solved with this PR? Have the problems reappeared later on? |
I think the reason here is that your persistence provider uses some configuration of JSON.NET, that doesn't support type name handling. There are two problems:
Usually when it comes to persistent serialization, I suggest people to write their own custom serializers (using eg. protobuf, FsPickler or whatever you want), to have full control of binary format and how it changes over time. |
Ok, that makes sense. I guess the question for Akkling specifically is whether we can do something to improve "debuggability" and help the next person who runs into this issue, since currently it pretty much fails silently with default settings when using |
Yes, I think we could do something about it. |
Hi! Is there a way to hook in to
PersistenceLifecycleEvent
in typed actors? I've looked at #72 and the test, but this seems only to work for untyped actors.Here is a fork with the same test for a typed actor (
Eventsourced<string>
), and it currently fails: Yakimych@c9dc995My guess is that typed actors don't receive messages of anything but the specified type, so I am wondering if this is possible at all.
The text was updated successfully, but these errors were encountered: