Story #8543
closed[NodeManager] Don't use Futures when not expecting a reply
100%
Description
Quoting #8437
on_failure is only called when there is no future associated with the message. As it turns out, all calls that use ActorProxy have an associated Future object, and all messaging between actors in node manager uses ActorProxy. This means unhandled exceptions are stored in a Future object to be returned to the caller. However, if the caller never calls get() on the Future object (because it never stored it), this means the exception is silently ignored.
These lingering future objects may also be creating circular references that is causing the memory leak.
Anywhere a message is sent between Actors where a response is not required, such as subscriptions, use tell()
on the ActorRef object instead of using ActorProxy (which uses ask()
). (May want to write a helper similar to ActorProxy, such as TellActorProxy
).
Anticipated benefits:
- Unhandled exceptions will be logged, and the on_failure method of the Actor be called as intended
- Possibly uncover previously unknown bugs (previously hidden due to exceptions being lost)
- May mitigate longstanding memory leak bug by avoiding creating Future objects that are not needed (and which may be actively harmful)