Skip Menu |

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

Report information
The Basics
Id: 76550
Status: resolved
Priority: 0/
Queue: POE-Component-Resolver

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

Bug Information
Severity: Wishlist
Broken in: 0.916
Fixed in: (no value)



Subject: Resolver doesn't destroy
when i use poe-component-client-http for check domain by ip, my program doesn't exit. Because in this way we don't send request to resolver and resolver doesn't call $kernel->delay(sidecar_eject => $heap->{idle_timeout}) I solved this problem, by calling $keepalive_obj->shutdown() in my program. I will be happy if resolver could destroyed whithout explicit call shutdown
On Sat Apr 14 08:33:40 2012, sergei wrote: Show quoted text
> when i use poe-component-client-http for check domain by ip, my program > doesn't exit. Because in this way we don't send request to resolver and > resolver doesn't call $kernel->delay(sidecar_eject => $heap->{idle_timeout}) > I solved this problem, by calling $keepalive_obj->shutdown() in my program. > I will be happy if resolver could destroyed whithout explicit call shutdown
If you shutdown POE::Component::Client::HTTP, it should shutdown Resolver and KeepAlive for you. Your program should exit quickly after that. In other words, you should not need to shut down KeepAlive and Resolver explicitly. Just Client::HTTP when you're done with that. Is this good enough?
From: kozunov [...] gmail.com
Вск Апр 29 19:29:49 2012, RCAPUTO писал: Show quoted text
> On Sat Apr 14 08:33:40 2012, sergei wrote:
> > when i use poe-component-client-http for check domain by ip, my
> program
> > doesn't exit. Because in this way we don't send request to resolver
> and
> > resolver doesn't call $kernel->delay(sidecar_eject => $heap- > >{idle_timeout}) > > I solved this problem, by calling $keepalive_obj->shutdown() in my
> program.
> > I will be happy if resolver could destroyed whithout explicit call
> shutdown > > If you shutdown POE::Component::Client::HTTP, it should shutdown > Resolver and KeepAlive for > you. Your program should exit quickly after that. > > In other words, you should not need to shut down KeepAlive and > Resolver explicitly. Just > Client::HTTP when you're done with that. > > Is this good enough?
Let's I show my problem.
Subject: for_cpan.pl
#!/usr/bin/perl -w use utf8; use strict; use warnings; use Data::Dumper; use POE 1.350; use POE::Component::Client::HTTP 0.944; use POE::Component::Client::Keepalive 0.270; use HTTP::Request::Common qw(GET HEAD); use HTTP::Cookies; $SIG{__WARN__} = sub { my $str = shift; warn scalar(localtime)." $str"; }; my $pool = POE::Component::Client::Keepalive->new( keep_alive => 3, max_open => 2, max_per_host => 2, timeout => 7, resolver => POE::Component::Resolver->new( max_resolvers => 1, idle_timeout => 11, ), ); POE::Component::Client::HTTP->spawn( Alias => 'ua', FollowRedirects => 3, Timeout => 13, MaxSize => 1024, Agent => '', ConnectionManager => $pool, Streaming => 0, CookieJar => HTTP::Cookies->new(), ); foreach my $i (1..2) { POE::Session->create( inline_states => { _start => sub { my $header = [TE => 'chunked,identity', Connection => "close"]; my $domain = '127.0.0.1:36333'; my $url = "http://$domain/$i"; my $request = HTTP::Request->new( 'GET', $url, $header); $poe_kernel->post( "ua" => "request", "response", $request, {domain=>$domain, i => $i}); }, _stop => sub {}, response => \&response, }, ); } POE::Kernel->run(); warn 1; exit; sub response { my ($request_packet, $response_packet) = @_[ARG0, ARG1]; my $http_request = $request_packet->[0]; my $tag = $request_packet->[1]; my $http_response = $response_packet->[0]; warn Dumper $tag; warn Dumper $http_response; }
Thank you very much for the bug report. I hope to release a fixed POE::Component::Resolver soon. Your test program was especially helpful. I have reduced it to only use POE::Component::Resolver, and I have included it as a regression test for future releases. commit 34d54dbcb61ada8b0f97b4e145723be9dc35c542 Author: Rocco Caputo <rcaputo@cpan.org> Date: Sat May 5 19:01:15 2012 -0400 [rt.cpan.org 76550] Avoid hang when no requests made. Fixed thanks to Sergei Kozunov's bug report and test case. A sidecar process was created at startup, but no idle timeout was set. These timeouts are only set when requests happen, and in an application where all addresses are already resolved, no timeout is set. So the component lingers forever.