Process finish due proxy garbage collection should trigger shutdown
For memory-safety reasons, every actor is automatically finished when its owner manager gets garbage-collected (from multiprocessing.managers.BaseManager
implementation).
We are exposing the Actor.shutdown
hook to be called because of main proxy ActorProxy.__exit__
or any ActorProxy.shutdown
calls, but it is not when process is finalized via garbage collection.
Really not an issue, but it's counter-intuitive. Calling Actor.shutdown
during garbage-collected finish should be considered.
Considerations
- Changing current behavior will render
__del__
method nearly useless (it became safe in py34), so maybe we should update the documentation and take no action. - Calling
shutdown
twice because ofActorProxy.__exit__
andActorProxy.shutdown
is currently ok-ish, sinceActorProxy.shutdown
calls are explicit and the implementer would be the one to blame here, but any extraActor.shutdown
call (after eitherActorProxy.__exit__
orActorProxy.shutdown
) caused by garbage-collection should be avoided by extra logic. Since both methods should already finish the process itself, this may not require any specific code (on the actor process side).
Edited by Felipe A. Hernandez