AskTimeoutException when actor does not reply within Timeout
0 reputation · 19 Dec 2020, 06:38 UTC
AskTimeoutException behavior
When using akka.pattern.ask with a Timeout, the framework throws an AskTimeoutException if the target actor fails to send a reply before the deadline. This exception is the primary signal for timeout handling in Akka applications.
Cancellation after actor termination
Actors may schedule work via a Cancellable. The cancel() method returns true if the task was successfully cancelled before execution, and false otherwise. However, the API does not specify what happens when cancel() is invoked after the owning actor has stopped, or after the scheduled task has already fired. This ambiguity can affect graceful shutdown logic and supervision strategies.
- What should
Cancellable.cancel()return when called after the owning actor has terminated but before the scheduled task has executed? - Is there a recommended pattern for cancelling pending
Cancellables in an actor’spostStophook to ensure consistent shutdown? - How does an
AskTimeoutExceptionpropagate through supervision strategies, and should it trigger cancellation of relatedCancellables?