Subject: | Missing documentation about avoiding zombie processes |
While building a script that connects to a lot of hosts one by one, I saw an increasing number of zombie child processes (ssh processes). After digging around a little bit, I found out, that Object::Remote does not handle the child process cleanup.
I think you should update the documentation, that this tasks has to be done in the main process, either by settings the SIGCHLD handler to 'IGNORE' or by doing a `wait` or `waitpid` call, to cleanup the processes.
It should also be noted, that Object::Remote->connect method return undef, if the connection fails and it's not possible to call the child_pid method to get the pid of the failed connection (for the SSH connector).
Example:
I think you should update the documentation, that this tasks has to be done in the main process, either by settings the SIGCHLD handler to 'IGNORE' or by doing a `wait` or `waitpid` call, to cleanup the processes.
It should also be noted, that Object::Remote->connect method return undef, if the connection fails and it's not possible to call the child_pid method to get the pid of the failed connection (for the SSH connector).
Example:
use Object::Remote; my @hosts = qw(host1 host2 host3 host4 host5); foreach my $host (@hosts) { my $conn = Object::Remote->connect('user@' . $host); sleep(5); }
If you monitor your processes with `htop`, you could see an increasing number of zombie childs below the parent.