I'm attempting to spawn long running processes using PoCo::Generic. Sometimes the processes run and sometimes they immediately stop and fail (like the trace shown below). What can cause these wheel read errors and what is the best way to clean each process up after it has finished?
I've turned trace and debug on and I notice that I'm constantly getting read errors on the wheel that exit with status 0 or status 13. I added some dumper values to show the state of $self (Generic.pm line 685 _wheel_err and Generic line 711 _child) when the errors happen. pid 19826 STDERR: 29: alias is 29 at Test/Debug_Modules/POE/Component/Generic.pm line 216. pid 19826 STDERR: 29: Ask to create object at Test/Debug_Modules/POE/Component/Generic.pm line 280. pid 19826 STDERR: 29: session 14 created for Jnms::Router::Sender at Test/Debug_Modules/POE/Component/Generic.pm line 53. pid 19826 STDERR: 29: autoload method create_message at Test/Debug_Modules/POE/Component/Generic.pm line 883. pid 19826 STDERR: 29: 19826: processing request create_message pid 19826 STDERR: 29: request put at Test/Debug_Modules/POE/Component/Generic.pm line 434. pid 19826 STDERR: 29:ERR: Setting debug=1 at /usr/local/lib/perl5/site_perl/5.10.0/POE/Component/Generic/Child.pm line 321. pid 19826 STDERR: 29:ERR: Setting verbose=1 at /usr/local/lib/perl5/site_perl/5.10.0/POE/Component/Generic/Child.pm line 321. pid 19826 STDERR: 29:ERR: build object Jnms::Router::Sender at /usr/local/lib/perl5/site_perl/5.10.0/POE/Component/Generic/Child.pm line 324. pid 19826 STDERR: 29:ERR: Child PID is 21187 pid 19826 STDERR: 29:ERR: object=Jnms::Router::Sender=HASH(0x423a628) at /usr/local/lib/perl5/site_perl/5.10.0/POE/Component/Generic/Child.pm line 329. pid 19826 STDERR: 29:ERR: reply pid 19826 STDERR: 29:ERR: method=create_message at /usr/local/lib/perl5/site_perl/5.10.0/POE/Component/Generic/Child.pm line 141. pid 19826 STDERR: 29:ERR: Calling create_message on Jnms::Router::Sender=HASH(0x423a628) at /usr/local/lib/perl5/site_perl/5.10.0/POE/Component/Generic/Child.pm line 185. pid 19826 STDERR: 29: __wheel_out at Test/Debug_Modules/POE/Component/Generic.pm line 656. pid 19826 STDERR: 29: Child PID=21187 at Test/Debug_Modules/POE/Component/Generic.pm line 734. pid 19826 STDERR: 29: __wheel_out at Test/Debug_Modules/POE/Component/Generic.pm line 656. pid 19826 STDERR: 29: (19826) Reply to 4/send_message at Test/Debug_Modules/POE/Component/Generic.pm line 787. pid 19826 STDERR: 29: autoload method send at Test/Debug_Modules/POE/Component/Generic.pm line 883. pid 19826 STDERR: 29: 19826: processing request send pid 19826 STDERR: 29: request put at Test/Debug_Modules/POE/Component/Generic.pm line 434. pid 19826 STDERR: 29:ERR: reply pid 19826 STDERR: 29:ERR: read pid 19826 STDERR: 29:ERR: request pid 19826 STDERR: 29:ERR: method=send at /usr/local/lib/perl5/site_perl/5.10.0/POE/Component/Generic/Child.pm line 141. pid 19826 STDERR: 29:ERR: Calling send on Jnms::Router::Sender=HASH(0x423a628) at /usr/local/lib/perl5/site_perl/5.10.0/POE/Component/Generic/Child.pm line 185. # In Generic line 685 print STDERR "WHEEL ERROR" . Dumper($self, $operation, $errnum, $errstr, $wheel_id); pid 19826 STDERR: WHEEL ERROR $VAR1 = bless( { pid 19826 STDERR: 'child_PID' => 21187, pid 19826 STDERR: 'verbose' => 1, pid 19826 STDERR: 'session_id' => 14, pid 19826 STDERR: 'referenced' => 1, pid 19826 STDERR: 'object_options' => [ pid 19826 STDERR: 'automation', pid 19826 STDERR: 1 pid 19826 STDERR: ], pid 19826 STDERR: 'debug' => 1, pid 19826 STDERR: 'store' => { pid 19826 STDERR: 'REQ000001' => { pid 19826 STDERR: 'wantarray' => 0, pid 19826 STDERR: 'session' => 4, pid 19826 STDERR: 'event' => 'executor_return', pid 19826 STDERR: 'alias' => '29', pid 19826 STDERR: 'package' => 'Jnms::Router::Sender' pid 19826 STDERR: } pid 19826 STDERR: }, pid 19826 STDERR: 'name' => '29', pid 19826 STDERR: 'RID' => 'REQ000002', pid 19826 STDERR: 'callback_map' => { pid 19826 STDERR: 'Jnms::Router::Sender' => {} pid 19826 STDERR: }, pid 19826 STDERR: 'package' => 'Jnms::Router::Sender', pid 19826 STDERR: 'factory_map' => {}, pid 19826 STDERR: 'postback_map' => { pid 19826 STDERR: 'Jnms::Router::Sender' => {} pid 19826 STDERR: }, pid 19826 STDERR: 'callback_defs' => {}, pid 19826 STDERR: 'package_map' => { pid 19826 STDERR: 'Jnms::Automation::Activate' => { pid 19826 STDERR: 'initialize' => 'Jnms::Automation::Manager', pid 19826 STDERR: 'start' => 'Jnms::Automation::Activate' pid 19826 STDERR: }, pid 19826 STDERR: 'Jnms::Router::Sender' => { pid 19826 STDERR: 'send' => 'Jnms::Router::Sender', pid 19826 STDERR: 'create_message' => 'Jnms::Router::Sender', pid 19826 STDERR: 'new' => 'Jnms::Router::Sender' pid 19826 STDERR: } pid 19826 STDERR: }, pid 19826 STDERR: 'alias' => '29', pid 19826 STDERR: 'wheel' => bless( [ pid 19826 STDERR: 11, pid 19826 STDERR: '__wheel_err', pid 19826 STDERR: '__wheel_close', pid 19826 STDERR: sub { "DUMMY" }, pid 19826 STDERR: 21187, pid 19826 STDERR: 'pipe', pid 19826 STDERR: 2, pid 19826 STDERR: 0, pid 19826 STDERR: undef, pid 19826 STDERR: \*Symbol::GEN37, pid 19826 STDERR: bless( [ pid 19826 STDERR: '', pid 19826 STDERR: sub { "DUMMY" }, pid 19826 STDERR: sub { "DUMMY" }, pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Filter::Reference' ), pid 19826 STDERR: bless( [ pid 19826 STDERR: [], pid 19826 STDERR: 0, pid 19826 STDERR: 0, pid 19826 STDERR: 65536, pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Driver::SysRW' ), pid 19826 STDERR: undef, pid 19826 STDERR: 'POE::Wheel::Run(11) -> select stdin', pid 19826 STDERR: 0, pid 19826 STDERR: $VAR1->{'wheel'}[9], pid 19826 STDERR: bless( [ pid 19826 STDERR: '', pid 19826 STDERR: $VAR1->{'wheel'}[10][1], pid 19826 STDERR: $VAR1->{'wheel'}[10][2], pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Filter::Reference' ), pid 19826 STDERR: $VAR1->{'wheel'}[11], pid 19826 STDERR: '__wheel_out', pid 19826 STDERR: 'POE::Wheel::Run(11) -> select stdout', pid 19826 STDERR: \*Symbol::GEN39, pid 19826 STDERR: bless( [ pid 19826 STDERR: '', pid 19826 STDERR: '(\\x0D\\x0A?|\\x0A\\x0D?)', pid 19826 STDERR: ' pid 19826 STDERR: ', pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Filter::Line' ), pid 19826 STDERR: bless( [ pid 19826 STDERR: [], pid 19826 STDERR: 0, pid 19826 STDERR: 0, pid 19826 STDERR: 65536, pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Driver::SysRW' ), pid 19826 STDERR: '__wheel_stderr', pid 19826 STDERR: 'POE::Wheel::Run(11) -> select stderr', pid 19826 STDERR: undef pid 19826 STDERR: ], 'POE::Wheel::Run' ) pid 19826 STDERR: }, 'POE::Component::Generic' ); pid 19826 STDERR: $VAR2 = 'read'; pid 19826 STDERR: $VAR3 = '0'; pid 19826 STDERR: $VAR4 = ''; pid 19826 STDERR: $VAR5 = 11; pid 19826 STDERR: 29: Wheel 11 generated read error 0: # See this message twice at Generic line 685 print STDERR "WHEEL ERROR" . Dumper($self, $operation, $errnum, $errstr, $wheel_id); pid 19826 STDERR: WHEEL ERROR$VAR1 = bless( { pid 19826 STDERR: 'child_PID' => 21187, pid 19826 STDERR: 'verbose' => 1, pid 19826 STDERR: 'session_id' => 14, pid 19826 STDERR: 'referenced' => 1, pid 19826 STDERR: 'object_options' => [ pid 19826 STDERR: 'automation', pid 19826 STDERR: 1 pid 19826 STDERR: ], pid 19826 STDERR: 'debug' => 1, pid 19826 STDERR: 'store' => { pid 19826 STDERR: 'REQ000001' => { pid 19826 STDERR: 'wantarray' => 0, pid 19826 STDERR: 'session' => 4, pid 19826 STDERR: 'event' => 'executor_return', pid 19826 STDERR: 'alias' => '29', pid 19826 STDERR: 'package' => 'Jnms::Router::Sender' pid 19826 STDERR: } pid 19826 STDERR: }, pid 19826 STDERR: 'name' => '29', pid 19826 STDERR: 'RID' => 'REQ000002', pid 19826 STDERR: 'callback_map' => { pid 19826 STDERR: 'Jnms::Router::Sender' => {} pid 19826 STDERR: }, pid 19826 STDERR: 'package' => 'Jnms::Router::Sender', pid 19826 STDERR: 'factory_map' => {}, pid 19826 STDERR: 'postback_map' => { pid 19826 STDERR: 'Jnms::Router::Sender' => {} pid 19826 STDERR: }, pid 19826 STDERR: 'callback_defs' => {}, pid 19826 STDERR: 'package_map' => { pid 19826 STDERR: 'Jnms::Automation::Activate' => { pid 19826 STDERR: 'initialize' => 'Jnms::Automation::Manager', pid 19826 STDERR: 'start' => 'Jnms::Automation::Activate' pid 19826 STDERR: }, pid 19826 STDERR: 'Jnms::Router::Sender' => { pid 19826 STDERR: 'send' => 'Jnms::Router::Sender', pid 19826 STDERR: 'create_message' => 'Jnms::Router::Sender', pid 19826 STDERR: 'new' => 'Jnms::Router::Sender' pid 19826 STDERR: } pid 19826 STDERR: }, pid 19826 STDERR: 'alias' => '29', pid 19826 STDERR: 'wheel' => bless( [ pid 19826 STDERR: 11, pid 19826 STDERR: '__wheel_err', pid 19826 STDERR: '__wheel_close', pid 19826 STDERR: sub { "DUMMY" }, pid 19826 STDERR: 21187, pid 19826 STDERR: 'pipe', pid 19826 STDERR: 1, pid 19826 STDERR: 0, pid 19826 STDERR: undef, pid 19826 STDERR: \*Symbol::GEN37, pid 19826 STDERR: bless( [ pid 19826 STDERR: '', pid 19826 STDERR: sub { "DUMMY" }, pid 19826 STDERR: sub { "DUMMY" }, pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Filter::Reference' ), pid 19826 STDERR: bless( [ pid 19826 STDERR: [], pid 19826 STDERR: 0, pid 19826 STDERR: 0, pid 19826 STDERR: 65536, pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Driver::SysRW' ), pid 19826 STDERR: undef, pid 19826 STDERR: 'POE::Wheel::Run(11) -> select stdin', pid 19826 STDERR: 0, pid 19826 STDERR: $VAR1->{'wheel'}[9], pid 19826 STDERR: bless( [ pid 19826 STDERR: '', pid 19826 STDERR: $VAR1->{'wheel'}[10][1], pid 19826 STDERR: $VAR1->{'wheel'}[10][2], pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Filter::Reference' ), pid 19826 STDERR: $VAR1->{'wheel'}[11], pid 19826 STDERR: '__wheel_out', pid 19826 STDERR: 'POE::Wheel::Run(11) -> select stdout', pid 19826 STDERR: \*Symbol::GEN39, pid 19826 STDERR: bless( [ pid 19826 STDERR: '', pid 19826 STDERR: '(\\x0D\\x0A?|\\x0A\\x0D?)', pid 19826 STDERR: ' pid 19826 STDERR: ', pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Filter::Line' ), pid 19826 STDERR: bless( [ pid 19826 STDERR: [], pid 19826 STDERR: 0, pid 19826 STDERR: 0, pid 19826 STDERR: 65536, pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Driver::SysRW' ), pid 19826 STDERR: '__wheel_stderr', pid 19826 STDERR: 'POE::Wheel::Run(11) -> select stderr', pid 19826 STDERR: undef pid 19826 STDERR: ], 'POE::Wheel::Run' ) pid 19826 STDERR: }, 'POE::Component::Generic' ); pid 19826 STDERR: $VAR2 = 'read'; pid 19826 STDERR: $VAR3 = '0'; pid 19826 STDERR: $VAR4 = ''; pid 19826 STDERR: $VAR5 = 11; pid 19826 STDERR: 29: Wheel 11 generated read error 0: pid 19826 STDERR: 29: Wheel closed # print STDERR "DUMPING NOW" . Dumper($self, $name, $PID, $ret); pid 19826 STDERR: DUMPING NOW$VAR1 = bless( { pid 19826 STDERR: 'child_PID' => 21187, pid 19826 STDERR: 'verbose' => 1, pid 19826 STDERR: 'session_id' => 14, pid 19826 STDERR: 'referenced' => 1, pid 19826 STDERR: 'object_options' => [ pid 19826 STDERR: 'automation', pid 19826 STDERR: 1 pid 19826 STDERR: ], pid 19826 STDERR: 'close' => 1, pid 19826 STDERR: 'debug' => 1, pid 19826 STDERR: 'store' => { pid 19826 STDERR: 'REQ000001' => { pid 19826 STDERR: 'wantarray' => 0, pid 19826 STDERR: 'session' => 4, pid 19826 STDERR: 'event' => 'executor_return', pid 19826 STDERR: 'alias' => '29', pid 19826 STDERR: 'package' => 'Jnms::Router::Sender' pid 19826 STDERR: } pid 19826 STDERR: }, pid 19826 STDERR: 'name' => '29', pid 19826 STDERR: 'RID' => 'REQ000002', pid 19826 STDERR: 'callback_map' => { pid 19826 STDERR: 'Jnms::Router::Sender' => {} pid 19826 STDERR: }, pid 19826 STDERR: 'package' => 'Jnms::Router::Sender', pid 19826 STDERR: 'factory_map' => {}, pid 19826 STDERR: 'postback_map' => { pid 19826 STDERR: 'Jnms::Router::Sender' => {} pid 19826 STDERR: }, pid 19826 STDERR: 'callback_defs' => {}, pid 19826 STDERR: 'package_map' => { pid 19826 STDERR: 'Jnms::Automation::Activate' => { pid 19826 STDERR: 'initialize' => 'Jnms::Automation::Manager', pid 19826 STDERR: 'start' => 'Jnms::Automation::Activate' pid 19826 STDERR: }, pid 19826 STDERR: 'Jnms::Router::Sender' => { pid 19826 STDERR: 'send' => 'Jnms::Router::Sender', pid 19826 STDERR: 'create_message' => 'Jnms::Router::Sender', pid 19826 STDERR: 'new' => 'Jnms::Router::Sender' pid 19826 STDERR: } pid 19826 STDERR: }, pid 19826 STDERR: 'alias' => '29', pid 19826 STDERR: 'wheel' => bless( [ pid 19826 STDERR: 11, pid 19826 STDERR: '__wheel_err', pid 19826 STDERR: '__wheel_close', pid 19826 STDERR: sub { "DUMMY" }, pid 19826 STDERR: 21187, pid 19826 STDERR: 'pipe', pid 19826 STDERR: 0, pid 19826 STDERR: 0, pid 19826 STDERR: undef, pid 19826 STDERR: \*Symbol::GEN37, pid 19826 STDERR: bless( [ pid 19826 STDERR: '', pid 19826 STDERR: sub { "DUMMY" }, pid 19826 STDERR: sub { "DUMMY" }, pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Filter::Reference' ), pid 19826 STDERR: bless( [ pid 19826 STDERR: [], pid 19826 STDERR: 0, pid 19826 STDERR: 0, pid 19826 STDERR: 65536, pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Driver::SysRW' ), pid 19826 STDERR: undef, pid 19826 STDERR: 'POE::Wheel::Run(11) -> select stdin', pid 19826 STDERR: 0, pid 19826 STDERR: $VAR1->{'wheel'}[9], pid 19826 STDERR: bless( [ pid 19826 STDERR: '', pid 19826 STDERR: $VAR1->{'wheel'}[10][1], pid 19826 STDERR: $VAR1->{'wheel'}[10][2], pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Filter::Reference' ), pid 19826 STDERR: $VAR1->{'wheel'}[11], pid 19826 STDERR: '__wheel_out', pid 19826 STDERR: 'POE::Wheel::Run(11) -> select stdout', pid 19826 STDERR: \*Symbol::GEN39, pid 19826 STDERR: bless( [ pid 19826 STDERR: '', pid 19826 STDERR: '(\\x0D\\x0A?|\\x0A\\x0D?)', pid 19826 STDERR: ' pid 19826 STDERR: ', pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Filter::Line' ), pid 19826 STDERR: bless( [ pid 19826 STDERR: [], pid 19826 STDERR: 0, pid 19826 STDERR: 0, pid 19826 STDERR: 65536, pid 19826 STDERR: 0 pid 19826 STDERR: ], 'POE::Driver::SysRW' ), pid 19826 STDERR: '__wheel_stderr', pid 19826 STDERR: 'POE::Wheel::Run(11) -> select stderr', pid 19826 STDERR: undef pid 19826 STDERR: ], 'POE::Wheel::Run' ) pid 19826 STDERR: }, 'POE::Component::Generic' ); pid 19826 STDERR: $VAR2 = 'CHLD'; pid 19826 STDERR: $VAR3 = 21187; pid 19826 STDERR: $VAR4 = '13'; pid 19826 STDERR: 29: Child 21187 exited with 13 at Test/Debug_Modules/POE/Component/Generic.pm line 716. pid 19826 STDERR: 29: _done at Test/Debug_Modules/POE/Component/Generic.pm line 306. pid 19826 STDERR: 29: drop wheel at Test/Debug_Modules/POE/Component/Generic.pm line 311. pid 19826 STDERR: 29: remove alias 29 at Test/Debug_Modules/POE/Component/Generic.pm line 322. pid 19826 STDERR: 29: _stop at Test/Debug_Modules/POE/Component/Generic.pm line 296.