Not seeing anything back out of STDOUT

[email protected] ("Simon Taylor")
Newsgroups perl.poe
Message-ID <CF268C57160BE84289D36FF46801A2C808602503@zharhxm0.corp.nortel.com>
Using POE::Wheel::Run to create forked children.

As soon as i fork them off I try and send some output back to the parent
but i never see it arrive.

At this point STDOUT in the child is not a TTY and lsof indicates its a
socket connection.

 

new_batch 30624 sdu 0u unix 0x00000100376a7680 9949033 socket 
new_batch 30624 sdu 1u unix 0x00000100376a7680 9949033 socket 
new_batch 30624 sdu 11u unix 0x00000100376a7680 9949033 socket

 

I'm thinking this is possibly how POE is connecting the child output
with that of the parent.

 

I've run POE in Debug mode and im not seeing any calls into the Event
Handler for STDOUT.

 

Setup as follows - STDERR seems to be working ok.

Any assistance appreciated.

 

 

sub StartTasks {

=Head3 _start

Function called when POE wants to start tasks

Shouldnt start any more than MAX_CONCURRENT_TASKS

When it does it spawns children

Event handlers allow information to be passed back to the parent process

Mapping between state and function is done in the object states line in
the POE::Session->create in _IterateChildrenParallel

 

=cut    

  my ($kernel, $self, $heap) = @_[KERNEL, OBJECT];

  my ($child, $task);

  $self->{_logger}->debug("Enter/Reentry");

  while (keys(%{$heap->{task}}) < MAX_CONCURRENT_TASKS) {

      if (ref($self->{_children}) eq "ARRAY"){

          $child = shift @{$self->{_children}};

          last unless defined $child;

          $self->{_logger}->debug("ARRAY "."Child = $child");

          $task = POE::Wheel::Run->new(

              Program      => sub {local *__ANON__ =
"_StartTasksProgramSub";

                                   $self->_CreateChild($child);

                                   },

              StdoutFilter => POE::Filter::Reference->new(),

              StdoutEvent  => "TaskResult",

              StderrEvent  => "TaskError",

              CloseEvent   => "TaskDone",

            );

            $heap->{task}->{$task->ID} = $task;

            $self->{_logger}->info("Created child Task/PID
".$task->ID."/".$task->PID);

            $_[KERNEL]->sig_child($task->PID, 'sig_child');

            

            # Wheel events include the wheel's ID.

            $_[HEAP]{children_by_wid}{$task->ID} = $task;

 

            # Signal events include the process ID.

            $_[HEAP]{children_by_pid}{$task->PID} = $task;

 

            

            

     } elsif (ref($self->{_children}) eq "HASH") {

              $self->{_logger}->debug("HASH "."Child = $child");

              $self->_CreateChild($child);

     } else {

              $self->{_logger}->debug("SCALAR "."Child = $child");

              $self->_CreateChild($child);

     } # If end

  } # While end

}

 

sub TaskResult {

  my ($self,$result) = @_[OBJECT, ARG0];

  $self->{_logger}->info("ID/PID/Result ID: $result->{taskid} :
$result->{pid} :$result->{status}\n");

  

  my %sec_status = %{$result->{section_status}};

  

  foreach my $key (%sec_status){

    $self->{_logger}->info("$sec_status{$key}\n");

  }

  

}

 

 

Simon Taylor

Development Team Lead NMS Applications

Network Managed Services

Nortel Networks

 

(e) [email protected]

(p) +44  1279 402291 ESN 6 742 2291

(m) +44 7740 533743 ESN 6 748 3743 

(yim) setuk_nortel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.