Skip Menu |

This queue is for tickets about the forks CPAN distribution.

Report information
The Basics
Id: 69578
Status: resolved
Priority: 0/
Queue: forks

People
Owner: RYBSKEJ [...] cpan.org
Requestors: Frank.Brendel [...] eurolog.com
Cc:
AdminCc:

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



Subject: uninitialized value within %TID2CLIENT
Date: Tue, 19 Jul 2011 15:03:51 +0000
To: "bug-forks [...] rt.cpan.org" <bug-forks [...] rt.cpan.org>
From: Frank Brendel <Frank.Brendel [...] eurolog.com>
Hi, if I kill a child thread with the KILL signal (to simulate a crash) and try to refill a Thread::Queue the parent thread hangs with the error: Use of uninitialized value within %TID2CLIENT in hash element at /usr/local/lib/perl/5.10.0/forks.pm line 3521. You can reproduce this behavior with the following code. #!/usr/bin/perl use forks; use Thread::Queue; my $JobQueue = Thread::Queue->new(); my $ThreadCount = 3; my $JobId = 0; while(1) { while (threads->list(threads::running) < $ThreadCount) { my $Thread = threads->new( \&ChildThread); } my $RunningThreadCount = threads->list(threads::running); my $i = 0; while($i < $RunningThreadCount){ $i++; $JobId++; $JobQueue->enqueue($JobId);} sleep 10; } sub ChildThread { while(my $JobId = $JobQueue->dequeue()) { print threads->tid() . " -- $JobId\n"; } } It seems that %TID2CLIENT needs a little more testing. Here's a diff that solves the problem for me 3519c3519 < if (defined $tid){ --- Show quoted text
> if (defined $tid && defined $TID2CLIENT{$tid}){
And here my version numbers. # perl -Mforks -e 'print $forks::VERSION . "\n";' 0.34 # perl -v This is perl, v5.10.0 built for i486-linux-gnu-thread-multi Copyright 1987-2007, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. # uname -a Linux elvsignetfb 2.6.26-2-686 #1 SMP Thu Jan 27 00:28:05 UTC 2011 i686 GNU/Linux
On Tue Jul 19 11:04:08 2011, Frank.Brendel@eurolog.com wrote: Show quoted text
> Hi, > > if I kill a child thread with the KILL signal (to simulate a crash) > and try to refill a Thread::Queue the parent thread hangs with the > error: > > Use of uninitialized value within %TID2CLIENT in hash element at > /usr/local/lib/perl/5.10.0/forks.pm line 3521. > > You can reproduce this behavior with the following code. > > #!/usr/bin/perl > > use forks; > use Thread::Queue; > > my $JobQueue = Thread::Queue->new(); > my $ThreadCount = 3; > my $JobId = 0; > while(1) > { > while (threads->list(threads::running) < $ThreadCount) > { > my $Thread = threads->new( \&ChildThread); > } > my $RunningThreadCount = threads->list(threads::running); > my $i = 0; > while($i < $RunningThreadCount){ $i++; $JobId++; $JobQueue-
> >enqueue($JobId);}
> sleep 10; > } > > sub ChildThread > { > while(my $JobId = $JobQueue->dequeue()) > { > print threads->tid() . " -- $JobId\n"; > } > } > > > It seems that %TID2CLIENT needs a little more testing. > > Here's a diff that solves the problem for me > > 3519c3519 > < if (defined $tid){ > ---
> > if (defined $tid && defined $TID2CLIENT{$tid}){
> > > And here my version numbers. > > # perl -Mforks -e 'print $forks::VERSION . "\n";' > 0.34 > > # perl -v > > This is perl, v5.10.0 built for i486-linux-gnu-thread-multi > > Copyright 1987-2007, Larry Wall > > Perl may be copied only under the terms of either the Artistic License > or the > GNU General Public License, which may be found in the Perl 5 source > kit. > > Complete documentation for Perl, including FAQ lists, should be found > on > this system using "man perl" or "perldoc perl". If you have access to > the > Internet, point your browser at http://www.perl.org/, the Perl Home > Page. > > # uname -a > Linux elvsignetfb 2.6.26-2-686 #1 SMP Thu Jan 27 00:28:05 UTC 2011 > i686 GNU/Linux
Fixed as proposed, in 0.35 release.