CJ7
CJ7

Reputation: 23275

warning using Parallel::ForkManager but only in Windows

I sometimes get this warning when using Parallel::ForkManager but only in Windows, not on a Unix based system. What does it mean and should I worry about it?

child process '-17108' disappeared. A call to waitpid outside of Parallel::ForkManager might have reaped it.

Here is the sample code from the docs that my code is based on:

use LWP::Simple;
use Parallel::ForkManager;

my @links=(
    ["http://www.foo.bar/rulez.data","rulez_data.txt"],
    ["http://new.host/more_data.doc","more_data.doc"],
);

# Max 30 processes for parallel download
my $pm = Parallel::ForkManager->new(30);

LINKS:
foreach my $linkarray (@links) {
    $pm->start and next LINKS; # do the fork

    my ($link, $fn) = @$linkarray;
    warn "Cannot get $fn from $link"
      if getstore($link, $fn) != RC_OK;

    $pm->finish; # do the exit in the child process
}

$pm->wait_all_children;

Upvotes: 4

Views: 869

Answers (1)

lakshmiVG
lakshmiVG

Reputation: 21

I had the similar issue and placing a sleep 1 before "$pm->start and next LINKS;" fixed the issue. I guess its due to continues forking, where Perl lost track of the fork processes. I may be wrong!

Upvotes: 2

Related Questions