我有时在使用
Parallel::ForkManager时会收到此警告,但仅限于Windows,而不是基于Unix的系统.这是什么意思,我应该担心吗?
child process ‘-17108’ disappeared. A call to
waitpid
outside of
Parallel::ForkManager might have reaped it.
以下是我的代码所基于的docs的示例代码:
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;
最佳答案 我有类似的问题,在“$pm->开始和下一个LINKS”之前放置一个睡眠1;
解决了这个问题.我猜它是由于继续分叉,Perl失去了对fork进程的跟踪.我可能错了!