|
There are two scenarios where this is not a complete fix:
1. when the remote peer is running OpenSSH 3.7.1p3
2. when the remote peer is running Sun's deployed SSH identified by 'SSH-1.99-Sun_SSH_1.1'
In those two cases, it appears the $select_class->select() call in Net::SSH::Perl::SSH2::client_loop blocks indefinitely waiting for input (when the length
of $stdin in Net::SSH::Perl::SSH2::cmd() is larger than 32678). Strangely enough, input
onto STDIN of the running tty is put into $stdin (not exactly sure how *that* happens,
but oh well) and then sent to the remote peer.
To get around this, we've implemented the following:
diff /opt/rcs/lib/Net/SSH/Perl/Channel.pm /opt/rcs/os_deployment/lib/Net/SSH/Perl/Channel.pm
191a192,193
> ## COVD FIX:
> $c->{ssh}->{DoOneLoop} = 10;
195a198,200
> ## COVD FIX: (yes, I know it's redundant)
> undef( $c->{ssh}->{DoOneLoop} );
> delete $c->{ssh}->{DoOneLoop};
diff /opt/rcs/lib/Net/SSH/Perl/Constants.pm /opt/rcs/os_deployment/lib/Net/SSH/Perl/Constants.pm
138c138
< 'MAX_PACKET_SIZE' => 256000,
---
> 'MAX_PACKET_SIZE' => 8192,
diff /opt/rcs/lib/Net/SSH/Perl/SSH2.pm /opt/rcs/os_deployment/lib/Net/SSH/Perl/SSH2.pm
302c303,306
< my($rready, $wready) = $select_class->select($rb, $wb);
---
> ## COVD FIX:
> $ssh->debug("Instantiating a select with $ssh->{DoOneLoop} second timeout.")
> if (exists $ssh->{DoOneLoop} && $ssh->{DoOneLoop} > 0);
> my($rready, $wready) = $select_class->select($rb, $wb, undef, ($ssh->{DoOneLoop} || undef
+));
313a318,319
> ## COVD FIX:
> last if ($ssh->{DoOneLoop});
Note that we've also adjusted the MAX_PACKET_SIZE contstant. The value that was there seemed to
increase the timeouts when there was no real good reason to do so. A smaller value seems to work
just fine. Files of 128MB have been successfully transferred via $stdin to cmd() with the above
fixes to various implementations of SSH (SSH-1.99-OpenSSH_3.7.1p2, SSH-1.99-Sun_SSH_1.0.1, and SSH-1.99-Sun_SSH_1.1).
cmv, thanks for the pointer initially.
-gilbert.
|