For Programmers: Free Programming Magazines  


Home > Archive > PERL POE > June 2006 > XMLRPC server problem (Perl 5.8)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author XMLRPC server problem (Perl 5.8)
Bob Maccione

2006-06-24, 8:38 am

Hi all,

I'm running on linux with perl 5.8.8, poe 0.3501 and component...XMLRPC
0.05.

If I have a runtime error in my code, POE goes into a loop (recursion it
appears) where it eats up all the memory on the box and with logging
enabled it generates the following line again and again..

<ss> stopping session 5 (POE::Session=ARRAY(0x9ff1cd0)) at
/hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 4575 ->
_stop (from hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm at
484)
<ss> stopping session 5 (POE::Session=ARRAY(0x9ff1cd0)) at
/hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 4575 ->
_stop (from hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm at
484)


I have the following test code that can reproduce it, can anyone
confirm if it's a perl 5.8 or poe problem? We just moved to 5.8 and the
latest POE (it's a new box and we wanted to start from scratch). It
doesn't appear to happen on some real old poe and perl 5.6.

there are 2 files, Foo and FooTst, run the Foo as nohup Foo & and then
the FooTst will cause the problem.

thanks for any help,
bob maccione

------------------------------------------------------------------------
------------------------------------------------------------------------
-----------------------
#!/usr/bin/perl -w -I .

use strict;

sub POE::Kernel::ASSERT_DEFAULT () { 1 }
sub POE::Kernel::TRACE_SESSIONS () { 1 }
use POE;
use POE::Component::Server::XMLRPC;

#
# load up context and enable the Debug/Logging, etc.
#
Init();

Main();



=item Init()

Do the one time stuff here..

=cut
sub Init {

Startup( 9191 );

}

=item Main()

Do the fancy main processing here..

=cut
sub Main {

$poe_kernel->run;
exit 0;

}


=item Startup()

This is called once from the main Init routine and is used to get the
ball rolli
ng.

input:
port - the port to listen on

returns:
nothin

=cut
sub Startup {
my $port = shift;

print STDERR "Startup: port $port\n";

POE::Component::Server::XMLRPC->new( alias => "xmlrpc", port => 'dev'
);

POE::Session->create
( inline_states =>
{ _start => \&SetupService,
_stop => \&ShutdownService,


# our stuff..
Test => \&Test,
},

options => { trace => 1, debug => 1 },
);

#
# we're done in the init stage for now

}

=item SetupService()

Start the listening service. You need to add a post for each txn you'll
want to support

=cut
sub SetupService {
my $kernel = $_[KERNEL];
print STDERR "SetupService\n";

# set all of the services
$kernel->post( xmlrpc => publish => dev => "Test" );

print STDERR "SetupService Done\n";

}

=item ShutDownService()

Stop the xmlrpc service

=cut
sub ShutDownService {
print STDERR "ShutdownService\n";

# unset all of the services
$_[KERNEL]->post( xmlrpc => rescind => dev => "Ngt" );
$_[KERNEL]->post( xmlrpc => rescind => dev => "Ping" );
$_[KERNEL]->post( xmlrpc => rescind => dev => "Search" );
$_[KERNEL]->post( xmlrpc => rescind => dev => "Test" );

print STDERR "ShutdownService Done\n";
}


=item Test()

Simple Test txn

=cut
sub Test {
my $transaction = $_[ARG0];
my $params = $transaction->params();
print STDERR "Running test routine\n";

$params->Foo();

$transaction->return( "Pong" );
}
------------------------------------------------------------------------
------------------------------------------------------------------------
-----------------------

this is the test code

------------------------------------------------------------------------
------------------------------------------------------------------------
-----------------------
#!/usr/bin/perl -w

# send in a ping txn to the listener
use strict;
use Debug;
use Data::Dumper;

use XMLRPC::Lite;

my $name = 'http://localhost:9191/xmlrpc';

my $txn = 'Ping';

print XMLRPC::Lite
-> proxy('http://localhost:9191/?session=dev')
-> Test()
-> result
;
------------------------------------------------------------------------
------------------------------------------------------------------------
-----------------------



David Davis

2006-06-27, 7:10 pm

This is exceptions related.
http://search.cpan.org/~rcaputo/POE...Watcher_Methods

An error in your _stop is causing an exception, POE delivers a signal,
notices it needs to stop your session and calls _stop, then an error occurs,
and you get the idea.

HTH
David

On 6/23/06, Bob Maccione <Bob_Maccione@hilton.com> wrote:
>
> Hi all,
>
> I'm running on linux with perl 5.8.8, poe 0.3501 and component...XMLRPC
> 0.05.
>
> If I have a runtime error in my code, POE goes into a loop (recursion it
> appears) where it eats up all the memory on the box and with logging
> enabled it generates the following line again and again..
>
> <ss> stopping session 5 (POE::Session=ARRAY(0x9ff1cd0)) at
> /hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 4575 ->
> _stop (from hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm at
> 484)
> <ss> stopping session 5 (POE::Session=ARRAY(0x9ff1cd0)) at
> /hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line 4575 ->
> _stop (from hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm at
> 484)
>
>
> I have the following test code that can reproduce it, can anyone
> confirm if it's a perl 5.8 or poe problem? We just moved to 5.8 and the
> latest POE (it's a new box and we wanted to start from scratch). It
> doesn't appear to happen on some real old poe and perl 5.6.
>
> there are 2 files, Foo and FooTst, run the Foo as nohup Foo & and then
> the FooTst will cause the problem.
>
> thanks for any help,
> bob maccione
>
> ------------------------------------------------------------------------
> ------------------------------------------------------------------------
> -----------------------
> #!/usr/bin/perl -w -I .
>
> use strict;
>
> sub POE::Kernel::ASSERT_DEFAULT () { 1 }
> sub POE::Kernel::TRACE_SESSIONS () { 1 }
> use POE;
> use POE::Component::Server::XMLRPC;
>
> #
> # load up context and enable the Debug/Logging, etc.
> #
> Init();
>
> Main();
>
>
>
> =item Init()
>
> Do the one time stuff here..
>
> =cut
> sub Init {
>
> Startup( 9191 );
>
> }
>
> =item Main()
>
> Do the fancy main processing here..
>
> =cut
> sub Main {
>
> $poe_kernel->run;
> exit 0;
>
> }
>
>
> =item Startup()
>
> This is called once from the main Init routine and is used to get the
> ball rolli
> ng.
>
> input:
> port - the port to listen on
>
> returns:
> nothin
>
> =cut
> sub Startup {
> my $port = shift;
>
> print STDERR "Startup: port $port\n";
>
> POE::Component::Server::XMLRPC->new( alias => "xmlrpc", port => 'dev'
> );
>
> POE::Session->create
> ( inline_states =>
> { _start => \&SetupService,
> _stop => \&ShutdownService,
>
>
> # our stuff..
> Test => \&Test,
> },
>
> options => { trace => 1, debug => 1 },
> );
>
> #
> # we're done in the init stage for now
>
> }
>
> =item SetupService()
>
> Start the listening service. You need to add a post for each txn you'll
> want to support
>
> =cut
> sub SetupService {
> my $kernel = $_[KERNEL];
> print STDERR "SetupService\n";
>
> # set all of the services
> $kernel->post( xmlrpc => publish => dev => "Test" );
>
> print STDERR "SetupService Done\n";
>
> }
>
> =item ShutDownService()
>
> Stop the xmlrpc service
>
> =cut
> sub ShutDownService {
> print STDERR "ShutdownService\n";
>
> # unset all of the services
> $_[KERNEL]->post( xmlrpc => rescind => dev => "Ngt" );
> $_[KERNEL]->post( xmlrpc => rescind => dev => "Ping" );
> $_[KERNEL]->post( xmlrpc => rescind => dev => "Search" );
> $_[KERNEL]->post( xmlrpc => rescind => dev => "Test" );
>
> print STDERR "ShutdownService Done\n";
> }
>
>
> =item Test()
>
> Simple Test txn
>
> =cut
> sub Test {
> my $transaction = $_[ARG0];
> my $params = $transaction->params();
> print STDERR "Running test routine\n";
>
> $params->Foo();
>
> $transaction->return( "Pong" );
> }
> ------------------------------------------------------------------------
> ------------------------------------------------------------------------
> -----------------------
>
> this is the test code
>
> ------------------------------------------------------------------------
> ------------------------------------------------------------------------
> -----------------------
> #!/usr/bin/perl -w
>
> # send in a ping txn to the listener
> use strict;
> use Debug;
> use Data::Dumper;
>
> use XMLRPC::Lite;
>
> my $name = 'http://localhost:9191/xmlrpc';
>
> my $txn = 'Ping';
>
> print XMLRPC::Lite
> -> proxy('http://localhost:9191/?session=dev')
> -> Test()
> -> result
> ;
> ------------------------------------------------------------------------
> ------------------------------------------------------------------------
> -----------------------
>
>
>
>


Bob Maccione

2006-06-27, 7:10 pm

wow, .

many thanks on where to look. I'll catch the exception and croak which
should do the trick..

________________________________

From: David Davis [mailto:david.davis@gmail.com]
Sent: Tuesday, June 27, 2006 3:05 PM
To: Bob Maccione
Cc: poe@perl.org
Subject: Re: XMLRPC server problem (Perl 5.8)


This is exceptions related.
http://search.cpan.org/~rcaputo/POE....pm#Signal_Watc
her_Methods

An error in your _stop is causing an exception, POE delivers a signal,
notices it needs to stop your session and calls _stop, then an error
occurs, and you get the idea.

HTH
David


On 6/23/06, Bob Maccione <Bob_Maccione@hilton.com> wrote:

Hi all,

I'm running on linux with perl 5.8.8, poe 0.3501 and
component...XMLRPC
0.05.

If I have a runtime error in my code, POE goes into a loop
(recursion it
appears) where it eats up all the memory on the box and with
logging
enabled it generates the following line again and again..

<ss> stopping session 5 (POE::Session=ARRAY(0x9ff1cd0)) at
/hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line
4575 ->
_stop (from
hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm at
484)
<ss> stopping session 5 (POE::Session=ARRAY(0x9ff1cd0)) at
/hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm line
4575 ->
_stop (from
hilton/lib/perl5/site_perl/5.8.8/POE/Resource/Sessions.pm at
484)


I have the following test code that can reproduce it, can
anyone
confirm if it's a perl 5.8 or poe problem? We just moved to 5.8
and the
latest POE (it's a new box and we wanted to start from scratch).
It
doesn't appear to happen on some real old poe and perl 5.6.

there are 2 files, Foo and FooTst, run the Foo as nohup Foo &
and then
the FooTst will cause the problem.

thanks for any help,
bob maccione


------------------------------------------------------------------------

------------------------------------------------------------------------
-----------------------
#!/usr/bin/perl -w -I .

use strict;

sub POE::Kernel::ASSERT_DEFAULT () { 1 }
sub POE::Kernel::TRACE_SESSIONS () { 1 }
use POE;
use POE::Component::Server::XMLRPC;

#
# load up context and enable the Debug/Logging, etc.
#
Init();

Main();



=item Init()

Do the one time stuff here..

=cut
sub Init {

Startup( 9191 );

}

=item Main()

Do the fancy main processing here..

=cut
sub Main {

$poe_kernel->run;
exit 0;

}


=item Startup()

This is called once from the main Init routine and is used to
get the
ball rolli
ng.

input:
port - the port to listen on

returns:
nothin

=cut
sub Startup {
my $port = shift;

print STDERR "Startup: port $port\n";

POE::Component::Server::XMLRPC->new( alias => "xmlrpc", port
=> 'dev'
);

POE::Session->create
( inline_states =>
{ _start => \&SetupService,
_stop => \&ShutdownService,


# our stuff..
Test => \&Test,
},

options => { trace => 1, debug => 1 },
);

#
# we're done in the init stage for now

}

=item SetupService()

Start the listening service. You need to add a post for each
txn you'll
want to support

=cut
sub SetupService {
my $kernel = $_[KERNEL];
print STDERR "SetupService\n";

# set all of the services
$kernel->post( xmlrpc => publish => dev => "Test" );

print STDERR "SetupService Done\n";

}

=item ShutDownService()

Stop the xmlrpc service

=cut
sub ShutDownService {
print STDERR "ShutdownService\n";

# unset all of the services
$_[KERNEL]->post( xmlrpc => rescind => dev => "Ngt" );
$_[KERNEL]->post( xmlrpc => rescind => dev => "Ping" );
$_[KERNEL]->post( xmlrpc => rescind => dev => "Search" );
$_[KERNEL]->post( xmlrpc => rescind => dev => "Test" );

print STDERR "ShutdownService Done\n";
}


=item Test()

Simple Test txn

=cut
sub Test {
my $transaction = $_[ARG0];
my $params = $transaction->params();
print STDERR "Running test routine\n";

$params->Foo();

$transaction->return( "Pong" );
}

------------------------------------------------------------------------


------------------------------------------------------------------------
-----------------------

this is the test code


------------------------------------------------------------------------

------------------------------------------------------------------------

-----------------------
#!/usr/bin/perl -w

# send in a ping txn to the listener
use strict;
use Debug;
use Data::Dumper;

use XMLRPC::Lite;

my $name = ' http://localhost:9191/xmlrpc
<http://localhost:9191/xmlrpc> ';

my $txn = 'Ping';

print XMLRPC::Lite
-> proxy('http://localhost:9191/?session=dev')
-> Test()
-> result
;

------------------------------------------------------------------------

------------------------------------------------------------------------
-----------------------







Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com