Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 49379
Status: resolved
Priority: 0/
Queue: POE

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

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



Subject: <sg> Error 10053 writing to signal pipe: Unknown error
Attached errors came after I pressed 'ctrl-C'. 'ctrl-C' might have been hit twice if that matters. error does not occur every time (fun, fun, fun) sometimes everything works as expected.
Subject: wr2.pl
#!/usr/bin/perl use warnings; use strict; my $wheel_run = 'POE::Wheel::Run'.(( $^O eq 'MSWin32' )?'::Win32':''); use POE ( 'Wheel::Run'.( ( $^O eq 'MSWin32' ) ? '::Win32' : '') ); POE::Session->create( inline_states => { _start => \&on_start, run_check => sub {print "run_check\n"; $_[KERNEL]->alarm_remove_all();}, got_child_stdout => \&on_child_stdout, got_child_stderr => \&on_child_stderr, got_child_close => \&on_child_close, got_child_signal => \&on_child_signal, pulse => \&pulse, event_sigint => sub { warn "Shutting down gracefully...\n"; $_[KERNEL]->sig_handled(); $_[KERNEL]->yield( 'run_check' ); return 0; }, } ); POE::Kernel->run(); exit 0; sub on_start { $_[KERNEL]->sig( INT => 'event_sigint' ); $_[KERNEL]->delay( 'pulse' => 1); my $child = $wheel_run->new( Program => sub{ eval { &foo }; warn $@ if ($@) }, StdoutEvent => "got_child_stdout", StderrEvent => "got_child_stderr", CloseEvent => "got_child_close", ); $_[KERNEL]->sig_child($child->PID, "got_child_signal"); # Wheel events include the wheel's ID. $_[HEAP]{children_by_wid}{$child->ID} = $child; # Signal events include the process ID. $_[HEAP]{children_by_pid}{$child->PID} = $child; print( "Child pid ", $child->PID, " started as wheel ", $child->ID, ".\n" ); } # Wheel event, including the wheel's ID. sub on_child_stdout { my ($stdout_line, $wheel_id) = @_[ARG0, ARG1]; my $child = $_[HEAP]{children_by_wid}{$wheel_id}; print "pid ", $child->PID, " STDOUT: $stdout_line\n"; } # Wheel event, including the wheel's ID. sub on_child_stderr { my ($stderr_line, $wheel_id) = @_[ARG0, ARG1]; my $child = $_[HEAP]{children_by_wid}{$wheel_id}; print "pid ", $child->PID, " STDERR: $stderr_line\n"; } # Wheel event, including the wheel's ID. sub on_child_close { my $wheel_id = $_[ARG0]; my $child = delete $_[HEAP]{children_by_wid}{$wheel_id}; # May have been reaped by on_child_signal(). unless (defined $child) { print "wid $wheel_id closed all pipes.\n"; return; } print "pid ", $child->PID, " closed all pipes.\n"; delete $_[HEAP]{children_by_pid}{$child->PID}; } sub on_child_signal { print "pid $_[ARG1] exited with status $_[ARG2].\n"; my $child = delete $_[HEAP]{children_by_pid}{$_[ARG1]}; # May have been reaped by on_child_close(). return unless defined $child; delete $_[HEAP]{children_by_wid}{$child->ID}; } sub pulse { print "heartbeat\n"; $_[KERNEL]->delay( 'pulse' => 5); } sub foo { for (1..10){ print "foo $_\n"; if ($_ == 5) { print "ZZZZzzzzz"; sleep (2); } } die 'oops'; 1; }
Subject: errors.txt
C:\>perl wr2.pl Child pid -2328 started as wheel 1. pid -2328 STDOUT: foo 1 pid -2328 STDOUT: foo 2 pid -2328 STDOUT: foo 3 pid -2328 STDOUT: foo 4 pid -2328 STDOUT: foo 5 heartbeat pid -2328 STDOUT: ZZZZzzzzzfoo 6 pid -2328 STDOUT: foo 7 pid -2328 STDOUT: foo 8 pid -2328 STDOUT: foo 9 pid -2328 STDOUT: foo 10 pid -2328 STDERR: oops at wr2.pl line 110. pid -2328 closed all pipes. pid -2328 exited with status 0. heartbeat heartbeat heartbeat [ ... snip 120 heartbeat lines. I got interupted and left it running. ...] heartbeat heartbeat ----- Please address any warnings or errors above this message, and try again. If there are none, or those messages are from within POE, then please mail them along with the following information to bug-POE@rt.cpan.org: --- <sg> Error 10053 writing to signal pipe: Unknown error ----- at C:/Perl/site/lib/POE/Resource/Signals.pm line 808 POE::Kernel::_data_sig_pipe_syswrite('\x{2}') called at C:/Perl/site/lib /POE/Resource/Signals.pm line 783 POE::Kernel::_data_sig_pipe_send('POE::Kernel', 'INT') called at C:/Perl /site/lib/POE/Loop/PerlSignals.pm line 27 POE::Kernel::_loop_signal_handler_generic('INT') called at C:/Perl/site/ lib/POE/Resource/Signals.pm line 854 eval {...} called at C:/Perl/site/lib/POE/Resource/Signals.pm line 854 POE::Kernel::_data_sig_pipe_sysread('POE::Kernel=ARRAY(0x1a8de74)') call ed at C:/Perl/site/lib/POE/Resource/Signals.pm line 820 POE::Kernel::_data_sig_pipe_read('POE::Kernel=ARRAY(0x1a8de74)', 6, 0) c alled at C:/Perl/site/lib/POE/Resource/FileHandles.pm line 247 POE::Kernel::_data_handle_enqueue_ready('POE::Kernel=ARRAY(0x1a8de74)', 0, 6) called at C:/Perl/site/lib/POE/Loop/Select.pm line 292 POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0x1a8de74)') called at C:/Perl/site/lib/POE/Loop/Select.pm line 334 POE::Kernel::loop_run('POE::Kernel=ARRAY(0x1a8de74)') called at C:/Perl/ site/lib/POE/Kernel.pm line 1320 POE::Kernel::run('POE::Kernel') called at wr2.pl line 29 ----- Please address any warnings or errors above this message, and try again. If there are none, or those messages are from within POE, then please mail them along with the following information to bug-POE@rt.cpan.org: --- <sg> Error 10053 writing to signal pipe: Unknown error ----- at C:/Perl/site/lib/POE/Resource/Signals.pm line 808 POE::Kernel::_data_sig_pipe_syswrite('\x{2}') called at C:/Perl/site/lib /POE/Resource/Signals.pm line 783 POE::Kernel::_data_sig_pipe_send('POE::Kernel', 'INT') called at C:/Perl /site/lib/POE/Loop/PerlSignals.pm line 27 POE::Kernel::_loop_signal_handler_generic('INT') called at C:/Perl/site/ lib/POE/Resource/Signals.pm line 854 eval {...} called at C:/Perl/site/lib/POE/Resource/Signals.pm line 854 POE::Kernel::_data_sig_pipe_sysread('POE::Kernel=ARRAY(0x1a8de74)') call ed at C:/Perl/site/lib/POE/Resource/Signals.pm line 820 POE::Kernel::_data_sig_pipe_read('POE::Kernel=ARRAY(0x1a8de74)', 6, 0) c alled at C:/Perl/site/lib/POE/Resource/FileHandles.pm line 247 POE::Kernel::_data_handle_enqueue_ready('POE::Kernel=ARRAY(0x1a8de74)', 0, 6) called at C:/Perl/site/lib/POE/Loop/Select.pm line 292 POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0x1a8de74)') called at C:/Perl/site/lib/POE/Loop/Select.pm line 334 POE::Kernel::loop_run('POE::Kernel=ARRAY(0x1a8de74)') called at C:/Perl/ site/lib/POE/Kernel.pm line 1320 POE::Kernel::run('POE::Kernel') called at wr2.pl line 29 ----- Please address any warnings or errors above this message, and try again. If there are none, or those messages are from within POE, then please mail them along with the following information to bug-POE@rt.cpan.org: --- <sg> Error 10053 writing to signal pipe: Unknown error ----- at C:/Perl/site/lib/POE/Resource/Signals.pm line 808 POE::Kernel::_data_sig_pipe_syswrite('\x{2}') called at C:/Perl/site/lib /POE/Resource/Signals.pm line 783 POE::Kernel::_data_sig_pipe_send('POE::Kernel', 'INT') called at C:/Perl /site/lib/POE/Loop/PerlSignals.pm line 27 POE::Kernel::_loop_signal_handler_generic('INT') called at C:/Perl/site/ lib/POE/Resource/Signals.pm line 854 eval {...} called at C:/Perl/site/lib/POE/Resource/Signals.pm line 854 POE::Kernel::_data_sig_pipe_sysread('POE::Kernel=ARRAY(0x1a8de74)') call ed at C:/Perl/site/lib/POE/Resource/Signals.pm line 820 POE::Kernel::_data_sig_pipe_read('POE::Kernel=ARRAY(0x1a8de74)', 6, 0) c alled at C:/Perl/site/lib/POE/Resource/FileHandles.pm line 247 POE::Kernel::_data_handle_enqueue_ready('POE::Kernel=ARRAY(0x1a8de74)', 0, 6) called at C:/Perl/site/lib/POE/Loop/Select.pm line 292 POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0x1a8de74)') called at C:/Perl/site/lib/POE/Loop/Select.pm line 334 POE::Kernel::loop_run('POE::Kernel=ARRAY(0x1a8de74)') called at C:/Perl/ site/lib/POE/Kernel.pm line 1320 POE::Kernel::run('POE::Kernel') called at wr2.pl line 29 S:\Plixer\scrutinizer\trunk>perl wr2.pl Child pid -2184 started as wheel 1. pid -2184 STDOUT: foo 1 pid -2184 STDOUT: foo 2 pid -2184 STDOUT: foo 3 pid -2184 STDOUT: foo 4 pid -2184 STDOUT: foo 5 heartbeat pid -2184 STDOUT: ZZZZzzzzzfoo 6 pid -2184 STDOUT: foo 7 pid -2184 STDOUT: foo 8 pid -2184 STDOUT: foo 9 pid -2184 STDOUT: foo 10 pid -2184 STDERR: oops at wr2.pl line 110. pid -2184 closed all pipes. pid -2184 exited with status 0. heartbeat heartbeat Shutting down gracefully... run_check C:\>
Seems to be fixed using POE::Wheel::Run r2664: C:\Users\rcaputo\poe\poe>perl rt49379.pl Child pid -6132 started as wheel 1. pid -6132 STDOUT: foo 1 pid -6132 STDOUT: foo 2 pid -6132 STDOUT: foo 3 pid -6132 STDOUT: foo 4 pid -6132 STDOUT: foo 5 heartbeat pid -6132 STDOUT: ZZZZzzzzzfoo 6 pid -6132 STDOUT: foo 7 pid -6132 STDOUT: foo 8 pid -6132 STDOUT: foo 9 pid -6132 STDOUT: foo 10 pid -6132 STDERR: oops at rt49379.pl line 112. pid -6132 closed all pipes. pid -6132 exited with status 0. heartbeat heartbeat Shutting down gracefully... heartbeat run_check C:\Users\rcaputo\poe\poe>
I can still reproduce this. Here is a little additional info. After about 25 heartbeats the perl process suddenly starts to consume 100% CPU. (Heartbeats keep scrolling by though.) Once the CPU spikes hitting ctrl-C once does nothing. A second ctrl-C produces the traceback. On Thu Sep 03 12:22:39 2009, RCAPUTO wrote: Show quoted text
> Seems to be fixed using POE::Wheel::Run r2664: > > C:\Users\rcaputo\poe\poe>perl rt49379.pl > Child pid -6132 started as wheel 1. > pid -6132 STDOUT: foo 1 > pid -6132 STDOUT: foo 2 > pid -6132 STDOUT: foo 3 > pid -6132 STDOUT: foo 4 > pid -6132 STDOUT: foo 5 > heartbeat > pid -6132 STDOUT: ZZZZzzzzzfoo 6 > pid -6132 STDOUT: foo 7 > pid -6132 STDOUT: foo 8 > pid -6132 STDOUT: foo 9 > pid -6132 STDOUT: foo 10 > pid -6132 STDERR: oops at rt49379.pl line 112. > pid -6132 closed all pipes. > pid -6132 exited with status 0. > heartbeat > heartbeat > Shutting down gracefully... > heartbeat > run_check > > C:\Users\rcaputo\poe\poe>
Hopefully resolved in r2666: rcaputo * r2666 /trunk/poe/lib/POE/Kernel.pm: Skip the signals pipe when RUNNING_IN_HELL. Child "processes" in Windows take out the parent's sockets when they close, causing hilarity in the signal pipe code. Probably in a lot of real applications, too. Surely there's a better way?