Skip to content
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

SerializationError #1160

Open
lyzkov opened this issue Aug 3, 2024 · 0 comments
Open

SerializationError #1160

lyzkov opened this issue Aug 3, 2024 · 0 comments

Comments

@lyzkov
Copy link

lyzkov commented Aug 3, 2024

I have encountered trouble receiving remote calls after successfully joining from the iOS to the macOS cluster.

13:52:04 error [sact://Boguś@127.0.0.1:7337�[1m/system/receptionist�[0;0m][OperationLogDistributedReceptionist.swift:861] Failed to pushOps: DistributedCluster.OpLogDistributedReceptionist.PushOps
// metadata:
// "actor/id": [$wellKnown: receptionist]
// "error": GenericRemoteCallError(message: "Remote call error of [SerializationError] type occurred")
// "receptionist/peer": [$wellKnown: receptionist]

I am running a sample project on the macOS cluster on 192.168.1.8:8228. The same philosopher dining sample was copied to a simple iOS app with little modification:

final class DiningPhilosophers {
    private var forks: [Fork] = []
    private var philosophers: [Philosopher] = []

    func run(for duration: Duration) async throws {
        let system = await ClusterSystem("Boguś") { settings in
            settings.bindPort = 7337
            settings.remoteCall.codableErrorAllowance = .all
        }

        system.cluster.join(host: "192.168.1.8", port: 8228)
        try await self.ensureCluster([system], within: .seconds(10))

        let leftFork = Fork(name: "fork-6", actorSystem: system)
        let rightFork = Fork(name: "fork-7", actorSystem: system)
        let bogus = Philosopher(
            name: "Boguś",
            leftFork: leftFork,
            rightFork: rightFork,
            actorSystem: system
        )

        await system.receptionist.checkIn(bogus, with: .thinkers)

        var thinkers: WeakActorDictionary<Philosopher> = [:]
        for await philosopher in await system.receptionist.listing(of: .thinkers) {
            print("Philosopher # \(philosopher.hashValue) exists!")
            thinkers.insert(philosopher)
        }

        try system.park(atMost: duration)
    }

    private func ensureCluster(_ systems: [ClusterSystem], within: Duration) async throws {
        let nodes = Set(systems.map(\.settings.bindNode))

        try await withThrowingTaskGroup(of: Void.self) { group in
            for system in systems {
                group.addTask {
                    try await system.cluster.waitFor(nodes, .up, within: within)
                }
            }
            // loop explicitly to propagagte any error that might have been thrown
            for try await _ in group {}
        }
    }
}

How can I fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant