You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thread 1: Fatal error: Error raised at top level: DistributedCluster.GenericRemoteCallError(message: "Remote call error of [ExecuteDistributedTargetError] type occurred")
#1156
Open
akbashev opened this issue
Jun 27, 2024
· 0 comments
This is very specific, but still a bit surprising.
When using a protocol with associated type, which will be used then as a generic (see reproducible for example)—cluster will crash with error:
Thread 1: Fatal error: Error raised at top level: DistributedCluster.GenericRemoteCallError(message: "Remote call error of [ExecuteDistributedTargetError] type occurred")
Basic reproducible
import Distributed
import DistributedCluster
typealiasDefaultDistributedActorSystem=ClusterSystemprotocolSomeProtocol:Codable{associatedtypeMessage:Codable}structImplementation:SomeProtocol{typealiasMessage=String}distributedactorWorkerActor{staticvarkey:DistributedReception.Key<WorkerActor>{"worker_actor"}distributedfunc getSome<S:SomeProtocol>(_ protocol:S, message:S.Message)->String{"help"}init(actorSystem:ClusterSystem)async{self.actorSystem = actorSystem
awaitself.actorSystem.receptionist.checkIn(self, with:WorkerActor.key)}}distributedactorReceptionistActor{varactors:[WorkerActor]=[]func listen(){Task{
for awaitactor in await actorSystem.receptionist.listing(of:WorkerActor.key){self.actors.append(actor)}}}distributedfunc getLatest()->WorkerActor?{self.actors.last
}init(actorSystem:ActorSystem)async{self.actorSystem = actorSystem
self.listen()}}letreceptionist=awaitClusterSystem("receptionist")letsomeActorsNode=awaitClusterSystem("spme_actors"){ settings in
settings.bindPort =1111}
receptionist.cluster.join(endpoint: someActorsNode.settings.endpoint)tryawait receptionist.cluster.joined(node: someActorsNode.cluster.node, within:.seconds(10))letreceptionistActor=awaitReceptionistActor(actorSystem: receptionist)letworker=awaitWorkerActor(actorSystem: someActorsNode)// local actor workstryawaitprint(worker.getSome(impl, message:"hello"))// wait a bit for receptionisttryawaitTask.sleep(for:.seconds(3))letremoteActor=tryawait receptionistActor.getLatest()letimpl=Implementation()// Remote actor will crashtryawaitprint(remoteActor?.getSome(impl, message:"hello")??"")print("done")
Note—everything will start working again if you'll change associated type to separate protocol, like:
Description
This is very specific, but still a bit surprising.
When using a protocol with associated type, which will be used then as a generic (see reproducible for example)—cluster will crash with error:
Basic reproducible
Note—everything will start working again if you'll change associated type to separate protocol, like:
and update function accordingly:
Environment
macOS 14.5, Xcode 15.4 (15F31d)
Backtrace
The text was updated successfully, but these errors were encountered: