Skip Menu |

This queue is for tickets about the POE-Component-SpreadClient CPAN distribution.

Report information
The Basics
Id: 65576
Status: resolved
Priority: 0/
Queue: POE-Component-SpreadClient

People
Owner: Nobody in particular
Requestors: rdb [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.09
Fixed in: 0.09



Subject: Weird FH generation issue. (fix attached)
After connecting to Spread, the module creates a filehandle associated with the Spread value, so that the ReadWrite wheel has a handle to watch. The code sez: ## SpreadClient.pm, line 151: open $_[HEAP]->{'FH'}, '<&=', $mbox; This sometimes fails!!! In POE's internals, there is: my $handle = fileno($fh) and when FH creation fails, it cascades into a really ugly problem. The fix is simple: ## SpreadClient.pm, line 151: open $_[HEAP]->{'FH'}, '<&=', $mbox until $_[HEAP]->{'FH'} && fileno($_[HEAP]->{'FH'}); The patch I've attached does the same thing but warns. My testing shows, it warns EVERY TIME!! ? Suggesting perhaps the call to fileno($fh) works "after a bit" ?
Subject: spreadclient_badfh.patch
--- POE-Component-SpreadClient-0.09/lib/POE/Component/SpreadClient.pm 2011-02-02 15:17:15.000000000 -0800 +++ SpreadClient-working/lib/POE/Component/SpreadClient.pm 2011-02-08 14:07:45.000000000 -0800 @@ -4,7 +4,7 @@ # Initialize our version $LastChangedRevision: 9 $ use vars qw( $VERSION ); -$VERSION = '0.09'; +$VERSION = '0.09_02'; # Load our stuff use 5.006; # to silence Perl::Critic's Compatibility::ProhibitThreeArgumentOpen @@ -148,7 +148,14 @@ $_[HEAP]->{'MBOX'} = $mbox; # Create a FH to feed into Wheel::ReadWrite + until ($_[HEAP]->{'FH'} && fileno($_[HEAP]->{'FH'})) { open $_[HEAP]->{'FH'}, '<&=', $mbox; + warn "SpreadClient: bad fh!!! retrying"; + } + + # production version: + # open $_[HEAP]->{'FH'}, '<&=', $mbox until $_[HEAP]->{'FH'} && fileno($_[HEAP]->{'FH'}); + # Finally, create the wheel! $_[HEAP]->{'WHEEL'} = POE::Wheel::ReadWrite->new(
So I posted that I was getting a warning *EVERY TIME*! This was incorrect... I was seeing that warning because of a logic error, NOT a FH->fileno fail. That being said, the problem still exists, and the until() bit seems to have fixed it for me.
Patch applied and released as v1.000, thanks! Let's hope you don't have to fix more issues :) -- ~Apocalypse