Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 17474
Status: resolved
Priority: 0/
Queue: Proc-Fork

People
Owner: Nobody in particular
Requestors: tewang [...] uci.edu
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: multi-child example
panic: startop repeatedly showed up. Are we missing something for this example?
Subject: forking.pl
use strict; use Proc::Fork; use IO::Pipe; my $num_children = 5; # How many children we'll create my @children; # Store connections to them $SIG{CHLD} = 'IGNORE'; # Don't worry about reaping zombies # Spawn off some children for my $num ( 1 .. $num_children ) { # Create a pipe for parent-child communication my $pipe = new IO::Pipe; # Child simply echoes data it receives, until EOF child { $pipe->reader; my $data; while ( $data = <$pipe> ) { chomp $data; print STDERR "child $num: [$data]\n"; } exit; }; # Parent here $pipe->writer; push @children, $pipe; } # Send some data to the kids for ( 1 .. 20 ) { # pick a child at random my $num = int rand $num_children; my $child = $children[$num]; print $child "Hey there.\n"; }
On Fri Feb 03 16:34:14 2006, guest wrote: Show quoted text
> panic: startop repeatedly showed up. Are we missing something for this > example?
Hmm. I can't reproduce any problems with the script you attached. What version of Perl are you using? (What does `perl -V` say?)
Subject: Re: [rt.cpan.org #17474] multi-child example
Date: Sun, 5 Feb 2006 15:32:00 -0800 (PST)
To: bug-Proc-Fork [...] rt.cpan.org
From: "Eric Wang" <tewang [...] uci.edu>
Show quoted text
> On Fri Feb 03 16:34:14 2006, guest wrote:
>> panic: startop repeatedly showed up. Are we missing something for this >> example?
> > Hmm. I can't reproduce any problems with the script you attached. What > version of Perl are you using? (What does `perl -V` say?) >
activestate version of perl 5.8.
Show quoted text
> activestate version of perl 5.8.
Hmm, that’s going to be a problem. `fork` works completely differently in Win32-Perls, which is probably the cause of the problem, but since I have no access to a Windows machine I have no idea where I would even being trying to track this down. Honestly, if I were you, I’d avoid this module (or anything else that uses `fork`) entirely and do something with threads, as that is Windows’ preferred way of implementing parallelism. But I’ll ask on PerlMonks if someone can give me a clue.
Actually, scratch that; here’s something you can try. I’ve rewritten your code to a straight equivalent that does not use Proc::Fork. If this code exhibits the same problem, then the bug is with ASPerl, not with Proc::Fork.
use strict; use IO::Pipe; my $num_children = 5; # How many children we'll create my @children; # Store connections to them $SIG{CHLD} = 'IGNORE'; # Don't worry about reaping zombies # Spawn off some children for my $num ( 1 .. $num_children ) { # Create a pipe for parent-child communication my $pipe = new IO::Pipe; my $pid = fork; die "Cannot fork: $!\n" if not defined $pid; # Child simply echoes data it receives, until EOF if( $pid == 0 ) { $pipe->reader; my $data; while ( $data = <$pipe> ) { chomp $data; print STDERR "child $num: [$data]\n"; } exit; }; # Parent here $pipe->writer; push @children, $pipe; } # Send some data to the kids for ( 1 .. 20 ) { # pick a child at random my $num = int rand $num_children; my $child = $children[$num]; print $child "Hey there.\n"; }
Subject: Re: [rt.cpan.org #17474] multi-child example
Date: Mon, 6 Feb 2006 09:20:01 -0800 (PST)
To: bug-Proc-Fork [...] rt.cpan.org
From: "Eric Wang" <tewang [...] uci.edu>
Interesting. It worked perfectly. Show quoted text
> Actually, scratch that; here’s something you can try. I’ve rewritten > your code to a straight equivalent that does not use Proc::Fork. > > If this code exhibits the same problem, then the bug is with ASPerl, not > with Proc::Fork. >
Hi again, I just uploaded a new version to the CPAN whose internals work somewhat differently. Can you please test whether you still have the same problem?
From: pagaltzis [...] gmx.de
Since I received no reply, I added tests to the latest version of Proc::Fork which are intended to catch this bug. I have now received reports from Windows systems where the version with these tests passes muster. Therefore I consider this issue resolved.
From: tewang [...] uci.edu
On Wed May 17 09:45:40 2006, ARISTOTLE wrote: Show quoted text
> Since I received no reply, I added tests to the latest version of > Proc::Fork which are intended to catch this bug. I have now received > reports from Windows systems where the version with these tests passes > muster. Therefore I consider this issue resolved.
Thanks! I didn't get a chance to relook at the problem since I just implemented it under linux.