Subject: | Possible leaked reference leads to hang |
Hi.
While using PoCo::Generic to wrap Net::OpenSSH, any calls to
Net::OpenSSH's scp_put() method causes the session to hang. However,
calls to Net::OpenSSH's system() method doesn't.
If I mix system() and scp_put() it doesn't hang, somehow.
dngor's assumption is that there is a leaked reference which causes it
to hang but was unable to locate it. Apparently, system() might be
pulling off an exit as a result of a bug that causes a crash, thus
making system() help PoCo::Generic end the session.
If I call PoCo::Generic's shutdown() method, it will allow the session
to close even when using only scp_put().
Here is a sample program:
use POE::Session;
use POE::Kernel;
use POE::Component::Generic;
use Net::OpenSSH;
sub start {
my $poco = POE::Component::Generic->spawn(
debug => 1,
verbose => 1,
package => 'Net::OpenSSH',
object_options => [ 'localhost', passwd => 'passwd' ],
methods => [ 'system', 'scp_put' ],
);
$poco->scp_put(
{ event => 'ack', data => { poco => $poco } },
'file',
'/tmp',
);
}
sub ack {
my $poco = $_[ARG0]->{'data'}{'poco'};
# without this next line, the session hangs till infinity
$poco->shutdown;
}
POE::Session->create(
inline_states => {
_start => \&start,
ack => \&ack,
},
);
POE::Kernel->run();