Subject: | Possible issue with pre-forked POE IKC Server implementation |
Distribution name : POE-Component-IKC-0.2302
Perl Version : 5.10.1
OS : GNU/Linux 2.6.18
issue: while using pre-fork functionality of POE IKC Server; we see that
POE Children stop entertaining further connection requests as soon as
they are done with first connection request per child.
analysis: by commenting the call to '_select_define' in 'else' part;
this issue gets resolved as we shouldn't stop accepting further
connection requests.
Please advise if our understanding is indeed correct and this needs a
fix
Attached is a client server example which simulates this behavior by
spawning 2 children to server 10 connections per child. However; client
calls start failing after 2 attempts as each child; after serving the
first connection; stops accepting further connection requests
<=Server Logs =>
$./IKCServer.pl
Initializing
7464: Created Tue Jan 8 22:38:28 2013
7463: Babysiting 2 children 7464, 7465
7465: Created Tue Jan 8 22:38:28 2013
7463: Telling everyone we are the parent
7464: 9 connections left
Got a ping request from client
7465: 9 connections left
Got a ping request from client
<=Client Logs=>
$ ./IKCClient.pl
calling remote Server
Got a response back
$./IKCClient.pl
calling remote Server
Got a response back
$ ./IKCClient.pl
POE connection failed:Timeout connecting to zzzzzzzzzzz:12367 at
./IKCClient.pl line 11.
Subject: | IKCServer.pl |
#!/tp64/perl/5.10.1/bin/perl
use strict;
use warnings;
use Sys::Hostname;
use POE;
use POE::Component::IKC::Server;
my $SERVER_HOST = hostname;
my $SERVER_PORT = 12367;
POE::Component::IKC::Server->spawn(
ip => $SERVER_HOST,
port => $SERVER_PORT,
name => 'IKCServer',
processes => 3,
connections => 10,
babysit => 900,
verbose =>1 ,
);
POE::Session->create(
inline_states => {
_start => \&init,
_stop => \&cleanUp,
pingMe => \&pingMe,
}
);
POE::Kernel->run();
exit 0;
sub init {
my $kernel = $_[KERNEL];
my $service_name = 'IKCServer';
print STDERR "Initializing\n";
$kernel->alias_set($service_name);
$kernel->post(IKC => publish => $service_name,['pingMe']);
return 1;
}
sub cleanUp {
my $kernel = $_[KERNEL];
print STDERR "Shutting Down!!!\n";
$kernel->call( IKC => 'shutdown' );
return 1;
}
sub pingMe {
my ( $kernel, $heap, $request ) = @_[ KERNEL, HEAP, ARG0 ];
my ( $args, $rsvp ) = @$request;
print STDERR "Got a ping request from client\n";
$kernel->call( IKC => post => $rsvp, 1 );
return 1;
}
Subject: | IKCClient.pl |
#!/tp64/perl/5.10.1/bin/perl
use strict;
use warnings;
use Sys::Hostname;
use POE::Component::IKC::ClientLite;
my $SERVER_HOST = hostname;
my $SERVER_PORT = 12367;
my $remoteClient = create_ikc_client(
ip => $SERVER_HOST,
port => $SERVER_PORT,
name => "Client-$$",
) or die "POE connection failed:".POE::Component::IKC::ClientLite::error();
print STDERR "calling remote Server\n";
my $ret = $remoteClient->post_respond('IKCServer/pingMe') or
die "POE call failed:".$remoteClient->error;
print STDERR "Got a response back\n";