Coder Social home page Coder Social logo

Comments (11)

Horusiath avatar Horusiath commented on August 12, 2024

Exception points to problems with deserializing type AA which is trying to get located in Akka.Persistence.PostgreSQL. I guess this is your custom type. What serializer have you picked up for it?

from akka.persistence.postgresql.

ctrlaltdan avatar ctrlaltdan commented on August 12, 2024

Hey @Horusiath

I should have mentioned this is the system shard coordinator which is failing to start.

From what I can see it's correctly stored the key AA as its pseudo "type" https://github.com/akkadotnet/akka.net/blob/dev/src/contrib/cluster/Akka.Cluster.Sharding/Serialization/ClusterShardingMessageSerializer.cs#L28 however it looks to me like Akka.Persistence.PostgreSQL is actually trying to create a new type of this constant value rather than follow the deserialization code path.

My setup doesn't make use of any custom serialization - everything should be using the defaults which I believe is Protobuf.

Thanks for your help!

from akka.persistence.postgresql.

Horusiath avatar Horusiath commented on August 12, 2024

@dubs999 Cluster sharding has its own dedicated serializer, which interprets manifests differently than akka default message serializer. Having that error message message means, that default is tried to being used on message deserialization.

Most probably you haven't included ClusterSharding.DefaultConfig() as a fallback configuration in your actor system:

var system = ActorSystem.Create("system", myConfig.WithFallback(ClusterSharding.DefaultConfig()));

from akka.persistence.postgresql.

ctrlaltdan avatar ctrlaltdan commented on August 12, 2024

Hey @Horusiath

I've copied and pasted the setup I'm using below. I have the fallback configuration already declared. Sorry if this is going off topic but we didnt cover persistence module setup in quite as much detail during Aaron's course.

Is there any additional fallback modules that are required for persistence/sharding?

var config = ConfigurationFactory
    .ParseString(Hocon())
    .WithFallback(ClusterSharding.DefaultConfig());

var system = ActorSystem.Create("my-system", config);

var sharding = ClusterSharding.Get(system);
var settings = ClusterShardingSettings
    .Create(system)
    .WithRole("transaction-v1");

ShardRegion = sharding.Start(
    "collect",
    Props.Create<CollectTransactionActor>(),
    settings,
    new MessageExtractor());

from akka.persistence.postgresql.

ctrlaltdan avatar ctrlaltdan commented on August 12, 2024

I don't know whether this is an over simplification but this is the line which appears to blow up.

https://github.com/AkkaNetContrib/Akka.Persistence.PostgreSql/blob/195b93873dcf7d6587fb3eecb2d4ca32f2942b5c/src/Akka.Persistence.PostgreSql/Snapshot/PostgreSqlQueryExecutor.cs#L143:L144

from akka.persistence.postgresql.

ctrlaltdan avatar ctrlaltdan commented on August 12, 2024

I've got a simple app which can repro this bug fairly easily. I've lowered the threshold at which a snapshot is taken to 10 to make the turnaround a bit more rapid.

https://github.com/dubs999/akka.net-cluster-sharding

Steps

  1. Load app
  2. Hit localhost:4010/[any-string]
  3. Repeat step 2 a few times to cause enough coordinator to reach 10+ journal entries (restarts seem to also cause more journal entries - I'm not 100% sure what the criteria is for creating these entries).
  4. Stop the app, restart it and see the Cluster application error on startup.

If there is anything obvious that's missing with this example then that would be super helpful.

Let me know if I can help in any other way.

Dan

from akka.persistence.postgresql.

Horusiath avatar Horusiath commented on August 12, 2024

You're right, @dubs999 . This is a bug.

from akka.persistence.postgresql.

ctrlaltdan avatar ctrlaltdan commented on August 12, 2024

Thanks @Horusiath

I guess I have a couple of options.

  1. I push up the limit at which a snapshot occurs to a really high number and run my application off of journal entries (until such time as the bug is fixed).
  2. I use an alternative persistence plugin.

Do you have customers which are using persistent sharding in production? If so, do you know which persistence plugin they are using?

We may also have some time to contribute a fix however our release deadline is fairly tight and I assume a public build wont be available in the very near term.

Many thanks

from akka.persistence.postgresql.

Horusiath avatar Horusiath commented on August 12, 2024

I know about several projects using Akka.Persistence.SqlServer. If I'm right redis plugin also should work, and mongodb plugin was modified some time ago specifically to also expose cluster sharding compatibility. Another option is to use cluster sharding in akka.cluster.sharding.state-store-mode = ddata mode, which doesn't need any persistence, however it won't allow you to use akka.cluster.sharding.remember-entities option.

from akka.persistence.postgresql.

ctrlaltdan avatar ctrlaltdan commented on August 12, 2024

I've submitted a PR which fixes the issue (when tested locally). I've not got a great deal of exposure to the Akka framework so apologies if the fix isn't robust enough.

#58

Thank you for all your help guys!

from akka.persistence.postgresql.

Aaronontheweb avatar Aaronontheweb commented on August 12, 2024

Closed via #60

from akka.persistence.postgresql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.