Skip Menu |

This queue is for tickets about the Parallel-Fork-BossWorker CPAN distribution.

Report information
The Basics
Id: 40026
Status: resolved
Priority: 0/
Queue: Parallel-Fork-BossWorker

People
Owner: TWILDE [...] cpan.org
Requestors: joechung [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.03
Fixed in: 0.04_01



Subject: Lack of explicit wait fills up process table after thousands of forks
OS: FreeBSD 6.3 Perl: 5.8.5 I wrote a script using Parallel::Fork::BossWorker 0.0.3 which forked many processes. Even though worker_count was limited to 8 and there was never more than 8 processes running at one time, after a thousand or so forks the program would crash, usually with a fork failed error. I believe the lack of an explicit wait() for the child filled up the process table. After I modified BossWorker.pm with the following diff, the failure disappeared and fork never failed again. *** ./site_perl/5.8/Parallel/Fork/BossWorker.pm Tue May 15 05:24:23 2007 --- /home/joechung/nfshome/Parallel/Fork/BossWorker.pm Mon Oct 13 22:13:25 2008 *************** *** 80,85 **** --- 80,89 ---- close($fh); } } + # Wait for children lest proc table fills up + while ((my $pid = wait()) != -1) { + } + }; if ($@) { *************** *** 101,107 **** # Fork off a worker my $pid = fork(); ! if ($pid > 0) { # Boss --- 105,112 ---- # Fork off a worker my $pid = fork(); ! (defined $pid) || confess("Fork failed: $!"); ! if ($pid > 0) { # Boss
I plan on releasing a new version shortly, I'll include this patch in that version. Thanks. On Tue Oct 14 01:25:22 2008, joechung wrote: Show quoted text
> OS: FreeBSD 6.3 > Perl: 5.8.5 > > I wrote a script using Parallel::Fork::BossWorker 0.0.3 which forked > many processes. Even though worker_count was limited to 8 and there was > never more than 8 processes running at one time, after a thousand or so > forks the program would crash, usually with a fork failed error. > > I believe the lack of an explicit wait() for the child filled up the > process table. > > After I modified BossWorker.pm with the following diff, the failure > disappeared and fork never failed again. > > *** ./site_perl/5.8/Parallel/Fork/BossWorker.pm Tue May 15 05:24:23 2007 > --- /home/joechung/nfshome/Parallel/Fork/BossWorker.pm Mon Oct 13 > 22:13:25 2008 > *************** > *** 80,85 **** > --- 80,89 ---- > close($fh); > } > } > + # Wait for children lest proc table fills up > + while ((my $pid = wait()) != -1) { > + } > + > }; > > if ($@) { > *************** > *** 101,107 **** > > # Fork off a worker > my $pid = fork(); > ! > if ($pid > 0) { > > # Boss > --- 105,112 ---- > > # Fork off a worker > my $pid = fork(); > ! (defined $pid) || confess("Fork failed: $!"); > ! > if ($pid > 0) { > > # Boss
From: joechung [...] yahoo.com
Thanks! Would it be possible to change the perl 5.8.8 requirement back to 5.8.5? I've been using it just fine on 5.8.5 with that patch. On Tue Oct 14 05:43:58 2008, JROD wrote: Show quoted text
> I plan on releasing a new version shortly, I'll include this patch in > that version. > > Thanks. >
We have a development release that includes your patch available for you to check out if you would like: http://search.cpan.org/~twilde/Parallel-Fork-BossWorker-0.04_1/ We expect to push this live as 0.04 within the next few days if no major problems are discovered. Thanks again for your feedback! Regards, Tim Wilde
Version 0.04, which should resolve this issue, has been released for some time. Please let me know if you encounter further problems! Regards, Tim
No further discussion, appears to work in our testing, resolving.