Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 32264
Status: rejected
Priority: 0/
Queue: POE

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

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



Subject: Got this dumped on my screen asking to be emailed
Date: Fri, 11 Jan 2008 23:23:51 -0500
To: bug-POE [...] rt.cpan.org
From: Zoffix Znet <zoffix [...] zoffix.com>
Got this dumped on my screen asking to be emailed... the code that produced this message is listed below. Please mail the following information to bug-POE@rt.cpan.org: SID not defined at /usr/local/share/perl/5.8.8/POE/Resource/SIDs.pm line 73 POE::Kernel::_data_sid_clear('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Session=ARRAY(0x83f3df4)') called at /usr/local/share/perl/5.8.8/POE/Resource/Sessions.pm line 173 POE::Kernel::_data_ses_free('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Session=ARRAY(0x83f3df4)') called at /usr/local/share/perl/5.8.8/POE/Resource/Sessions.pm line 509 POE::Kernel::_data_ses_stop('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Session=ARRAY(0x83f3df4)') called at /usr/local/share/perl/5.8.8/POE/Resource/Sessions.pm line 435 POE::Kernel::_data_ses_collect_garbage('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Session=ARRAY(0x83f3df4)') called at /usr/local/share/perl/5.8.8/POE/Resource/Signals.pm line 429 POE::Kernel::_data_sig_free_terminated_sessions('POE::Kernel=ARRAY(0x82ba8d0)') called at /usr/local/share/perl/5.8.8/POE/Kernel.pm line 951 POE::Kernel::_dispatch_event('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Kernel=ARRAY(0x82ba8d0)', '_signal', 16, 'ARRAY(0x83f41e4)', '/usr/local/share/perl/5.8.8/POE/Resource/Signals.pm', 518, 'undef', ...) called at /usr/local/share/perl/5.8.8/POE/Resource/Events.pm line 257 POE::Kernel::_data_ev_dispatch_due('POE::Kernel=ARRAY(0x82ba8d0)') called at /usr/local/share/perl/5.8.8/POE/Loop/Select.pm line 315 POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0x82ba8d0)') called at /usr/local/share/perl/5.8.8/POE/Loop/Select.pm line 323 POE::Kernel::loop_run('POE::Kernel=ARRAY(0x82ba8d0)') called at /usr/local/share/perl/5.8.8/POE/Kernel.pm line 1254 POE::Kernel::run('POE::Kernel=ARRAY(0x82ba8d0)') called at test.pl line 18 Please mail the following information to bug-POE@rt.cpan.org: SID not defined at /usr/local/share/perl/5.8.8/POE/Resource/SIDs.pm line 73 POE::Kernel::_data_sid_clear('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Session=ARRAY(0x83f3df4)') called at /usr/local/share/perl/5.8.8/POE/Resource/Sessions.pm line 173 POE::Kernel::_data_ses_free('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Session=ARRAY(0x83f3df4)') called at /usr/local/share/perl/5.8.8/POE/Resource/Sessions.pm line 509 POE::Kernel::_data_ses_stop('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Session=ARRAY(0x83f3df4)') called at /usr/local/share/perl/5.8.8/POE/Resource/Sessions.pm line 435 POE::Kernel::_data_ses_collect_garbage('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Session=ARRAY(0x83f3df4)') called at /usr/local/share/perl/5.8.8/POE/Resource/Signals.pm line 429 POE::Kernel::_data_sig_free_terminated_sessions('POE::Kernel=ARRAY(0x82ba8d0)') called at /usr/local/share/perl/5.8.8/POE/Kernel.pm line 951 POE::Kernel::_dispatch_event('POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Kernel=ARRAY(0x82ba8d0)', 'POE::Kernel=ARRAY(0x82ba8d0)', '_signal', 16, 'ARRAY(0x83f41e4)', '/usr/local/share/perl/5.8.8/POE/Resource/Signals.pm', 518, 'undef', ...) called at /usr/local/share/perl/5.8.8/POE/Resource/Events.pm line 257 POE::Kernel::_data_ev_dispatch_due('POE::Kernel=ARRAY(0x82ba8d0)') called at /usr/local/share/perl/5.8.8/POE/Loop/Select.pm line 315 POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0x82ba8d0)') called at /usr/local/share/perl/5.8.8/POE/Loop/Select.pm line 323 POE::Kernel::loop_run('POE::Kernel=ARRAY(0x82ba8d0)') called at /usr/local/share/perl/5.8.8/POE/Kernel.pm line 1254 POE::Kernel::run('POE::Kernel=ARRAY(0x82ba8d0)') called at test.pl line 18 package POE::Component::WWW::Search::Mininova; use 5.008008; use strict; use warnings; our $VERSION = '0.01'; use WWW::Search::Mininova; use POE 0.38 qw(Wheel::Run Filter::Line Filter::Reference); use Carp; sub spawn { my $class = shift; croak "$class requires an even number of arguments" if @_ & 1; my %args = @_; $args{ lc $_ } = delete $args{ $_ } for keys %args; eval { require WWW::Search::Mininova; }; croak "Failed to load WWW::Search::Mininova ($@)" if $@; my $self = bless \%args, $class; $self->{session_id} = POE::Session->create( object_states => [ $self => { search => '_search', shutdown => '_shutdown', }, $self => [ qw( _child_error _child_closed _child_stdout _child_stderr _sig_child _start _stop ) ], ], ( defined $args{options} ? ( options => $args{options} ) : () ) )->ID; return $self; } sub _start { my ( $kernel, $self ) = @_[ KERNEL, OBJECT ]; $self->{session_id} = $_[SESSION]->ID; print "Alias: $self->{alias}\n"; if ( $self->{alias} ) { $kernel->alias_set( $self->{alias} ); } else { $kernel->refcount_increment( $self->{session_id} => __PACKAGE__ ); } $self->{wheel} = POE::Wheel::Run->new( Program => '_search_wheel', ErrorEvent => '_child_error', CloseEvent => '_child_closed', StdoutEvent => '_child_stdout', StderrEvent => '_child_stderr', StdoutFilter => POE::Filter::Reference->new, StderrFilter => POE::Filter::Line->new, ( $^O eq 'MSWin32' ? ( CloseOnCall => 0 ) : ( CloseOnCall => 1 ) ) ); $kernel->yield('shutdown') unless $self->{wheel}; $kernel->sig_child( $self->{wheel}->PID, '_sig_child' ); undef; } sub _sig_child { $poe_kernel->sig_handled(); } sub session_id { return $_[0]->{session_id}; } sub search { my $self = shift; $poe_kernel->post( $self->{session_id} => 'search' => @_ ); } sub _search { my ( $kernel, $self ) = @_[ KERNEL, OBJECT ]; my $sender = $_[SENDER]->ID; return if $self->{shutdown}; my $args; if ( ref $_[ARG0] eq 'HASH' ) { $args = { %{ $_[ARG0] } }; } else { carp "Arguments must be passed in a hashref... trying to adjust"; $args = { @_[ ARG0..$#_ ] }; } $args->{ lc $_ } = delete $args->{ $_ } for grep { $_ !~ /^_/ } keys %{ $args }; unless ( $args->{event} ) { warn "No event to send output to was specified"; } unless ( $args->{term} ) { carp "No search term specified"; } if ( $args->{session} ) { if ( my $session_ref = $kernel->alias_resolve( $args->{session} ) ) { $self->{sender} = $session_ref->ID; } else { carp "Could not resolve ``session`` to a valid POE session"; return; } } else { $self->{sender} = $sender; } $kernel->refcount_increment( $sender => __PACKAGE__ ); $self->{wheel}->put( $args ); use Data::Dumper; print Dumper( [ 'pushing these args:', $args ] ); # 'rm' } sub shutdown { my $self = shift; $poe_kernel->call( $self->{session_id} => 'shutdown' => @_ ); } sub _stop { $poe_kernel->stop; } sub _shutdown { my ( $kernel, $self ) = @_[ KERNEL, OBJECT ]; $kernel->alarm_remove_all(); $kernel->alias_remove( $_ ) for $kernel->alias_list; $kernel->refcount_decrement( $self->{session_id} => __PACKAGE__ ) unless $self->{alias}; $self->{shutdown} = 1; $self->{wheel}->shutdown_stdin if $self->{wheel}; undef; } sub _child_closed { my ( $kernel, $self ) = @_[ KERNEL, OBJECT ]; delete $self->{wheel}; $kernel->yield('shutdown') unless $self->{shutdown}; undef; } sub _child_error { my ( $kernel, $self ) = @_[ KERNEL, OBJECT ]; delete $self->{wheel}; $kernel->yield('shutdown') unless $self->{shutdown}; undef; } sub _child_stderr { my ( $kernel, $self, $input ) = @_[ KERNEL, OBJECT, ARG0 ]; carp $input if $self->{debug}; undef; } sub _child_stdout { my ( $kernel, $self, $input ) = @_[ KERNEL, OBJECT, ARG0 ]; use Data::Dumper; print Dumper( [ 'input:', $input ] ); # 'rm' my $session = delete $input->{sender}; my $event = delete $input->{event}; use Data::Dumper; open my $fh, '>', 'debug' or die; print $fh "I SEE YOU\n"; close $fh; # 'rm' $kernel->post( $session => $event => $input ); $kernel->refcount_decrement( $session => __PACKAGE__ ); undef; } sub _search_wheel { if ( $^O eq 'MSWin32' ) { binmode STDIN; binmode STDOUT; } my $raw; my $size = 4096; my $filter = POE::Filter::Reference->new; use Data::Dumper; open my $fh, '>', 'debug'; print $fh "I R TEH WHEEL\n"; close $fh; # 'rm' my $mini = WWW::Search::Mininova->new; while ( sysread STDIN, $raw, $size ) { my $requests = $filter->get( [ $raw ] ); foreach my $req ( @{ $requests } ) { if ( $req->{category} ) { $mini->category( $req->{category} ); } if ( $req->{sort} ) { $mini->sort( $req->{sort} ); } $req->{out} = $mini->search( $req->{term} ); my $response = $filter->put( [ $req ] ); print STDOUT @$response; } } } 1; ######### the actual script #!/usr/bin/perl -w use strict; use warnings; sub POE::Kernel::ASSERT_DEFAULT () { 1 } # sub POE::Kernel::TRACE_DEFAULT () { 1 } use POE qw(Component::WWW::Search::Mininova); my $poco = POE::Component::WWW::Search::Mininova->spawn( alias => 'mini' ); POE::Session->create( package_states => [ 'main' => [ qw(_start mini _stop) ], ] ); $poe_kernel->run; sub _stop { $poe_kernel->shutdown; } sub _start { my ( $kernel, $heap ) = @_[ KERNEL, HEAP ]; $kernel->post( 'mini' => 'search' => { term => 'foo', event => 'mini', _arbitrary_value => 'whatever', } ); undef; } sub mini { my ( $kernel, $heap, $results ) = @_[ KERNEL, HEAP, ARG0 ]; use Data::Dumper; if ( $results->{out} ) { print Dumper( $results->{out} ); } print $results->{_arbitrary_value}, "\n"; undef; }
My assumption is that it's not really a bug, but I followed as the "code" told me and emailed :) Sadly I see that my code snippet lost all of its indentation. However, if you may note that I've used StdoutFilter instead of StdioFilter, now I don't get those messages. Just wanted to let you know so you wouldn't have to go over this code for 2 hours like I did ;) cheers.
It looks as if POE is reacting poorly to application error. Unfortunately Perl doesn't provide enough protection to react well in all cases.