Skip Menu |

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

Report information
The Basics
Id: 68702
Status: resolved
Priority: 0/
Queue: POE-Component-Client-Ping

People
Owner: Nobody in particular
Requestors: iulia.bublea [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.163
Fixed in: (no value)



Subject: Undefined filehandle in select_read()
Hello, The configuration is: Linux satmanage 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux This is perl, v5.10.0 built for x86_64-linux-thread-multi I have used the POE::Component::Client::Ping, in the context of having several remotes (from 1000 - 300000) with the parallelism varying from 500 - 2000. At around 10000 remotes with the parallelism of 500 there seemed to come up an error: Can't use an undefined value as a symbol reference at POE/Resource/FileHandles.pm line 467. This seemed to be due to the fact that there was no reference to the handle. Digging some more, it got me to the point where I noticed that in POE/Component/Client/Ping.pm the _check_for_close method was called in some cases twice, once within _send_packet method and another time immediately after the latter method. I guess, closing the socket the first time is going well because the reference to the handler exists, but the second time, this gives an error as the handler reference does not exist anymore. My temporary solution was to comment out the second call of the _check_for_close function. My question is if you consider this to be a bug? And what can I do about it? I have attached a file with the error I managed to output. Thanks in advance, Iulia Bublea
Subject: error.txt
sending packet sequence number 8659 stopping raw socket watcher at /opt/Intra/lib/CPAN/lib/perl5//POE/Component/Client/Ping.pm line 501. closing raw socket at /opt/Intra/lib/CPAN/lib/perl5//POE/Component/Client/Ping.pm line 504. stopping raw socket watcher at /opt/Intra/lib/CPAN/lib/perl5//POE/Component/Client/Ping.pm line 501. <us> undefined filehandle in select_read() at /opt/Intra/lib/CPAN/lib/perl5//POE/Kernel.pm line 2189 POE::Kernel::select_read('POE::Kernel=ARRAY(0x11e0c7e8)', undef) called at /opt/Intra/lib/CPAN/lib/perl5//POE/Component/Client/Ping.pm line 502 POE::Component::Client::Ping::_check_for_close('POE::Kernel=ARRAY(0x11e0c7e8)', 'HASH(0x12990540)') called at /opt/Intra/lib/CPAN/lib/perl5//POE/Component/Client/Ping.pm line 639 POE::Component::Client::Ping::poco_ping_default(undef, 'POE::Session=ARRAY(0x12990630)', 'POE::Kernel=ARRAY(0x11e0c7e8)', 'HASH(0x12990540)', '_default', 'POE::Session=ARRAY(0x12990630)', undef, '/opt/Intra/lib/CPAN/lib/perl5//POE/Kernel.pm', 1892, ...) called at /opt/Intra/lib/CPAN/lib/perl5//POE/Session.pm line 463 POE::Session::_invoke_state('POE::Session=ARRAY(0x12990630)', 'POE::Session=ARRAY(0x12990630)', 8658, 'ARRAY(0x134062d0)', '/opt/Intra/lib/CPAN/lib/perl5//POE/Kernel.pm', 1892, 8657) called at /opt/Intra/lib/CPAN/lib/perl5//POE/Kernel.pm line 1100 eval {...} called at /opt/Intra/lib/CPAN/lib/perl5//POE/Kernel.pm line 1099 POE::Kernel::_dispatch_event('POE::Kernel=ARRAY(0x11e0c7e8)', 'POE::Session=ARRAY(0x12990630)', 'POE::Session=ARRAY(0x12990630)', 8658, 512, 'ARRAY(0x134062d0)', '/opt/Intra/lib/CPAN/lib/perl5//POE/Kernel.pm', 1892, 8657, ...) called at /opt/Intra/lib/CPAN/lib/perl5//POE/Resource/Events.pm line 266 POE::Kernel::_data_ev_dispatch_due('POE::Kernel=ARRAY(0x11e0c7e8)') called at /opt/Intra/lib/CPAN/lib/perl5//POE/Loop/Select.pm line 315 POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0x11e0c7e8)') called at /opt/Intra/lib/CPAN/lib/perl5//POE/Loop/Select.pm line 323 POE::Kernel::loop_run('POE::Kernel=ARRAY(0x11e0c7e8)') called at /opt/Intra/lib/CPAN/lib/perl5//POE/Kernel.pm line 1276 POE::Kernel::run('POE::Kernel=ARRAY(0x11e0c7e8)') called at test_latency_poller_proxy.pl line 110
From: iulia.bublea [...] gmail.com
Commenting the subroutines was not the best solution. The clean solution that I found was to test whether the socket handler is defined or not, each time before trying to close it. And only if it is defined we should attempt to close it. I provide here the piece of code with my fix: sub _check_for_close { my ($kernel, $heap) = @_; if ( $heap->{socket_handle} ) { unless (scalar(keys %{$heap->{ping_by_seq}})) { DEBUG_SOCKET and warn "stopping raw socket watcher"; $kernel->select_read( $heap->{socket_handle} ); unless ($heap->{keep_socket}) { DEBUG_SOCKET and warn "closing raw socket"; delete $heap->{socket_handle}; } } } } In POE/Component/Client/Ping.pm at line 499, the if test was added. This probably happens that the $heap->{ping_by_seq} hash is sometimes empty the first time when there is an attempt to close the socket and sometimes it's not. Regards, Iulia Bublea On Wed Jun 08 10:12:51 2011, iuliabublea wrote: Show quoted text
> Hello, > > The configuration is: > > Linux satmanage 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009
x86_64 Show quoted text
> x86_64 x86_64 GNU/Linux > > This is perl, v5.10.0 built for x86_64-linux-thread-multi > > I have used the POE::Component::Client::Ping, in the context of having > several remotes (from 1000 - 300000) with the parallelism varying from > 500 - 2000. At around 10000 remotes with the parallelism of 500 there > seemed to come up an error: > > Can't use an undefined value as a symbol reference at > POE/Resource/FileHandles.pm line 467. > > This seemed to be due to the fact that there was no reference to the > handle. Digging some more, it got me to the point where I noticed that > in POE/Component/Client/Ping.pm the _check_for_close method was called > in some cases twice, once within _send_packet method and another time > immediately after the latter method. > > I guess, closing the socket the first time is going well because the > reference to the handler exists, but the second time, this gives an > error as the handler reference does not exist anymore. > > My temporary solution was to comment out the second call of the > _check_for_close function. > > > My question is if you consider this to be a bug? And what can I do
about Show quoted text
> it? > > I have attached a file with the error I managed to output. > > > Thanks in advance, > > Iulia Bublea
Hello, Iulia. Has your fix worked well for you? I'd just like to know before applying the change to the next release. On Wed Jun 08 12:39:37 2011, iuliabublea wrote: Show quoted text
> Commenting the subroutines was not the best solution. The clean solution > that I found was to test whether the socket handler is defined or not, > each time before trying to close it. And only if it is defined we should > attempt to close it. > > I provide here the piece of code with my fix:
[....]
Subject: Re: [rt.cpan.org #68702] Undefined filehandle in select_read()
Date: Sun, 31 Jul 2011 05:24:41 -0700
To: bug-POE-Component-Client-Ping [...] rt.cpan.org
From: Iulia Bublea <iulia.bublea [...] gmail.com>
Hi, Yes it worked great, solved all my problems. Regards, Iulia On Sat, Jul 30, 2011 at 2:39 PM, Rocco Caputo via RT < bug-POE-Component-Client-Ping@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=68702 > > > Hello, Iulia. > > Has your fix worked well for you? I'd just like to know before applying > the change to the next release. > > On Wed Jun 08 12:39:37 2011, iuliabublea wrote:
> > Commenting the subroutines was not the best solution. The clean solution > > that I found was to test whether the socket handler is defined or not, > > each time before trying to close it. And only if it is defined we should > > attempt to close it. > > > > I provide here the piece of code with my fix:
> [....] >
Thank you for reporting and testing this. I am committing your fix as part of change 27c7a7d. It will be in the next release.