Yes, plain text looks like a very large data structure to
POE::Filter::Reference. It is busy buffering data until it has enough
to thaw(). That behavior appears to the application as if the filter
has stalled.
--
Rocco Caputo - rcap...@pobox.com
On Nov 10, 2009, at 04:29, Simon Taylor wrote:
Thanks Rocco you are right.
I came across the solution myself last night after discovering all the
POE ASSERT settings.
Trawled the stats at the end - could see many POE::Wheel::Run "select
stdout" activities but nothing that was calling the StdOut Event
Handler.
So I removed the StdoutFilter and now I'm getting to see all the
output
from the child process.
Now I just have to work out why POE::Filter::Reference was being
stalled.
Am I right in thinking that if the child sends anything on STDOUT that
isn't POE::Filter::Reference text then it stalls the comms for the
lifetime of that child process not just that instance of
POE::Wheel::Run
"select stdout"??
If this is the case then I maybe have some untrapped output I need to
chase down. Which I guess I can do by leaving the filter off.
Simon
Simon Taylor
Development Team Lead NMS Applications
Network Managed Services
Nortel Networks
(e) s...@nortel.com
(p) +44 1279 402291 ESN 6 742 2291
(m) +44 7740 533743 ESN 6 748 3743
(yim) setuk_nortel
-----Original Message-----
From: Rocco Caputo [mailto:rcap...@pobox.com]
Sent: 09 November 2009 23:04
To: POE Mailing List
Subject: Re: Not seeing anything back out of STDOUT
This can happen with POE::Filter::Reference if the child process
displays some non-POE::Filter::Reference text. POE::Filter::Reference
does its best to interpret the child process' output as legal data,
and it patiently awaits the completion of a bad record.
The socket connection is made by creating the socket in the parent
process, then sharing it between the parent and child after the fork()
duplicates it. No client/server shenanigans are performed to set up
the connection.
It could be something else, but I can't tell without seeing more
code. :)
--
Rocco Caputo - rcap...@pobox.com
On Nov 9, 2009, at 06:05, Simon Taylor wrote:
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) s...@nortel.com
(p) +44 1279 402291 ESN 6 742 2291
(m) +44 7740 533743 ESN 6 748 3743
(yim) setuk_nortel