Pascal666 has asked for the wisdom of the Perl Monks concerning the following question:
I've tried the below code on a couple different Linux boxes. They all seem to get data corruption reading the index. The below works fine if you un-rem the 'next' (disabling Parallel::ForkManager) or gunzip the index beforehand and remove the ':gzip' (disabling PerlIO::gzip). Number of concurrent threads does not appear to matter. The corruption appears to always start at about the same line number for each index, but at different line numbers for different indexes. Running the same thing multiple times will sometimes yield the same exact corruption and sometimes not. A couple indexes (100K each) you can test with: 2015-27 2015-48
#!/usr/bin/perl use strict; use warnings; use Parallel::ForkManager; use PerlIO::gzip; my $pm = Parallel::ForkManager->new(12); open(IN, '<:gzip', 'wat.paths.gz') or die "can't open index"; while (my $file = <IN>) { print length($file) . ":$file\n" if length($file) > 142; #next; next if $pm->start; $pm->finish; } close IN; $pm->wait_all_children;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: PerlIO::gzip and Parallel::ForkManager do not play nice
by marioroy (Prior) on Mar 29, 2016 at 02:46 UTC |
Back to
Seekers of Perl Wisdom