Hello,
I'm writing a distributed application using POE. The
program uses POE::Wheel::SocketFactory and then on success
it uses POE::Wheel::ReadWrite to handle the socket. After a
successful connection occurs the SuccessState is called and
is passed my socket and wheel_id that created the socket.
Normally I just need to send a message and then disconnect
the socket. I've been creating a ReadWrite wheel with the
new socket and then stuffing the readwrite wheel_id in the
heap along with the host and port, like:
my $wheel = new POE::Wheel::ReadWrite
.....
my $wheel_id = $wheel->ID;
$heap->{$wheel_id}{readwrite} = $wheel;
$heap->{$wheel_id}{peername} = $peername;
Then I use $wheel->put("FOO") to send a message to the
remote host.
For the FlushedState and ErrorState of the ReadWrite wheel I
delete the $wheel_id from the heap hoping that the garbage
collection should take place automagically. It doesn't seem
to be happening. After awhile, accept() fails because to
many filehandles are open and I can't seem figure out how to
get POE to shut them down and garbage collect. I've tried
using POE::Kernel::TRACE_EVENTS and
POE::Kernel::TRACE_GARBAGE but all I can see is that my
ref_cnt seems to be increasing each time this happens and
the open_fh's keep incrementing. I'd appreciate any ideas
on why this is happening and how I can avoid it. Thanks in
advance.
Regards,
Todd
ps - To put it in today's terms, POE is off the hook!