Subject: | Infinite loop, pegs cpu and does not exit when using sftp. |
Date: | Thu, 8 Mar 2007 14:07:43 -0800 |
To: | bug-Net-SSH2 [...] rt.cpan.org |
From: | Rutger Ovidius <r_ovidius [...] eml.cc> |
Perl 5.8.8, Linux
libssh2-0.13
Net-SSH2-0.08 to 0.10 has this problem.
Net-SSH2-0.07 does not have this problem.
Snippet:
---
my $ssh2 = Net::SSH2->new();
# Login stuff...
my $sftp = $ssh2->sftp();
my $infile = $sftp->open("some file that exists");
$ssh2->disconnect();
---
Does not exit, but pegs the CPU at 100%. "strace -p <pid>" shows an
endless loop of:
recv(3, "", 16, 0x4000) = 0
Adding debug output to SSH2.c shows that it locks up in the
close_handle call.
--
line 1556 "SSH2.xs"
debug("%s::DESTROY\n", class);
clear_error(fi->sf->ss);
libssh2_sftp_close_handle(fi->handle); <- here.
---
Reverting this 1 line in the "typemap" file in the O_FILE section:
- sv_magic((SV*)io, newRV((SV*)gv), PERL_MAGIC_tiedscalar, Nullch, 0);
+ sv_magic((SV*)io, $arg, PERL_MAGIC_tiedscalar, Nullch, 0);
allows it to exit properly.