Skip Menu |

This queue is for tickets about the Net-SFTP CPAN distribution.

Report information
The Basics
Id: 24352
Status: rejected
Priority: 0/
Queue: Net-SFTP

People
Owner: Nobody in particular
Requestors: cg2v [...] andrew.cmu.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: sometimes loops doing select/read on stdin
Date: Sat, 13 Jan 2007 01:59:42 -0500 (EST)
To: bug-net-sftp [...] rt.cpan.org
From: Chaskiel M Grundman <cg2v [...] andrew.cmu.edu>
I use Net::SFTP in a batch job. Sometimes (I have not identified the trigger), I will find that the script is hung. truss shows a poll/read loop, reading from a fd opened to /dev/null. I eventually figured out that this fd was dup()'d from stdin by Net::SSH::Perl:SSH2::_session_channel. Thinking it was silly for the non-interactive sftp session to have a stdin/stdout/stderr, I replaced the _session_channel call in Net::SFTP::_open_channel with my $cmgr = $ssh->channel_mgr; my $channel = $cmgr->new_channel( ctype => 'session', local_window => 32*1024, local_maxpacket => 16*1024, remote_name => 'client-session'); But that didn't work; Net::SFTP->new hung selecting the tcp socket. After some trial and error, I determined that Net::SSH::Perl will not call the _output_buffer handler unless there's a wfd socket that selects as writable. I provided a /dev/null socket as wfd, did not provide rfd or efd, and things started working again. I won't know for weeks or months wether this actually fixes the read-from-/dev/null issue (which is probably the same problem as bug#7481 in Net::SSH::Perl) Here's the patch I'm using: --- lib/Net/SFTP.pm Sat Jan 13 00:41:38 2007 +++ lib/Net/SFTP.pm Sat Jan 13 01:41:32 2007 @@ -9,6 +9,7 @@ use Net::SFTP::Buffer; use Net::SSH::Perl::Constants qw( :msg2 ); use Net::SSH::Perl 1.24; +use IO::File; use Carp qw( carp croak ); @@ -74,8 +75,14 @@ sub _open_channel { my $sftp = shift; my $ssh = $sftp->{ssh}; + my $cmgr = $ssh->channel_mgr; - my $channel = $ssh->_session_channel; + my $channel = $cmgr->new_channel( + ctype => 'session', local_window => 32*1024, + local_maxpacket => 16*1024, remote_name => 'client-session', + wfd => new IO::File '> /dev/null'); + +# my $channel = $ssh->_session_channel; $channel->open; $channel->register_handler(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, sub {
Can't take this without a consistent repro and justification for the fix.