Project: mesos
Issue MESOS-3910: Libprocess: Implement cleanup of the SocketManager in process::finalize
The {{socket_manager}} and {{process_manager}} are intricately tied together. Currently, only the {{process_manager}} is cleaned up by {{process::finalize}}. To clean up the {{socket_manager}}, we must close all sockets and deallocate any existing {{HttpProxy}} or {{Encoder}} objects. And we should prevent further objects from being created/tracked by the {{socket_manager}}. *Proposal* # Clean up all processes other than {{gc}}. This will clear all links and delete all {{HttpProxy}} s while {{socket_manager}} still exists. # Close all sockets via {{SocketManager::close}}. All of {{socket_manager}} 's state is cleaned up via {{SocketManager::close}}, including termination of {{HttpProxy}} (termination is idempotent, meaning that killing {{HttpProxy}} s via {{process_manager}} is safe). # At this point, {{socket_manager}} should be empty and only the {{gc}} process should be running. (Since we're finalizing, assume there are no threads trying to spawn processes.) {{socket_manager}} can be deleted. # {{gc}} can be deleted. This is currently a leaked pointer, so we'll also need to track and delete that. # {{process_manager}} should be devoid of processes, so we can proceed with cleanup (join threads, stop the {{EventLoop}}, etc).
Story points: 5