Dead letter when remote call target is dead#989
Conversation
|
|
||
| return self.namingLock.withLock { | ||
| return try self.namingLock.withLock { | ||
| guard let managed = self._managedDistributedActors.get(identifiedBy: id) else { |
There was a problem hiding this comment.
IIUC, only local resolve would reach here? In other words, it's not part of remote call code path?
| do { | ||
| guard let actor = self.resolve(id: recipient) else { | ||
| self.log.error("Unable to resolve recipient \(recipient). Message will be dropped: \(invocation)") | ||
| self.deadLetters.tell(DeadLetter(invocation, recipient: recipient)) |
There was a problem hiding this comment.
Should the dead letter happen at sender, after getting back DeadLetterError? Or both sender and recipient? 🤔
There was a problem hiding this comment.
On the recipient I believe, since the recipient will has no function that will throw, so this dead letter informs that system that "someone is calling things on you, but they can't get through to the recipient actor".
And the caller has the function that they called that resulted in a dead letter, that function should throw as it received s the error reply from the dead-letter-ed remoteCall. This way the caller knows it happened, we don't need to log it there.
|
|
||
| public struct DeadLetterError: DistributedActorSystemError, Codable { | ||
| public let recipient: ClusterSystem.ActorID | ||
| } |
| try await watcher.watch(greeter!) | ||
|
|
||
| greeter = nil | ||
| try p.expectMessage(prefix: "Received terminated: /user/Greeter") |
There was a problem hiding this comment.
Oh we're missing API to p.watch a DA from a TestProbe it seems? If you want that'd be a great thing to implement...
We'd want to be able to p.watch(watcher); p.expectTerminated()
ktoso
left a comment
There was a problem hiding this comment.
Tests and impl look good! Just a minor nitpick about not logging in one place.
LGTM, please merge at will 👍
Co-authored-by: Konrad `ktoso` Malawski <konrad.malawski@project13.pl>
Co-authored-by: Konrad `ktoso` Malawski <konrad.malawski@project13.pl>
Resolves #943