That's not a problem. start reaps children as well. Consider the following example:
my $max_children = 5;
my $pm = Parallel::ForkManager->new($max_children);
for my $i (0..9) {
$pm->start and next;
#...
$pm->finish;
}
$pm->wait_all_children;
- The 6th start will reap a child.
- The 7th start will reap a child.
- The 8th start will reap a child.
- The 9th start will reap a child.
- The 10th start will reap a child.
- wait_all_children will reap the remaining 5 children.
With your infinite loop, it's no different. You'll be reaping child every time you create one (once you've created $max_children children).
It's a bug to use waitpid in a run_on_finish handler since the process has already been reaped by then.