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 of ActorProxy.__exit__ and ActorProxy.shutdown is currently ok-ish, since ActorProxy.shutdown calls are explicit and the implementer would be the one to blame here, but any extra Actor.shutdown call (after either ActorProxy.__exit__ or ActorProxy.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