Subject: | BUG-CMD hangs on over large amount of data |
Date: | Tue, 10 Jun 2008 10:46:52 -0400 |
To: | bug-Net-SSH-Perl [...] rt.cpan.org |
From: | "Xiaohu Li" <xiaohuli914 [...] gmail.com> |
*Hi,
The bug is not new and there is a post on resolved bug on
cpanforum.orgwith ID number 7910.
I was trying to send a about 32KB data to remote machine and write to a
file.
Here is my script.*
==============================================================================================
#! /usr/bin/perl -w
use Time::HiRes qw(time);
use Net::SSH::Perl;
$TIME=time;
printf "Time before %.8f\n",$TIME;
system "scp perl-ssh-test.dat lxh\@arches-n1:perl-ssh-test.dat.ssh";
$TIME=time;
printf "Time after 1 %.8f\n",$TIME;
$OUT="perl-ssh-test.dat.perl";
open (FILE,"perl-ssh-test.dat");
$LOG = do { local $/; <FILE> };
#@LOG = <FILE>;
close(FILE);
%params=(protocol => 2,debug=>1);
$ssh = Net::SSH::Perl->new("arches-n1",%params);
$ssh->login("lxh");
my ($stdout, $stderr, $exit)=$ssh->cmd("cat - > $OUT" , $LOG);
#printf "OUTPUT %s\n",$stderr;
$TIME=time;
printf "Time after 2 %.8f\n",$TIME;
==============================================================================================
*I found that I got the following error:
Received disconnect message: Corrupted MAC on input.
I read about the post 7910, and did what the post suggest to do and this
time. I got no message and the program will just hang there forever. I
turned on the debug option and this is where the program hangs:*
===============================================================================================
bl-chem-iyengar3: Reading configuration data /home/xl5/.ssh/config
bl-chem-iyengar3: Reading configuration data /etc/ssh_config
bl-chem-iyengar3: Connecting to arches-n1, port 22.
bl-chem-iyengar3: Remote version string: SSH-1.99-OpenSSH_4.6
bl-chem-iyengar3: Remote protocol version 1.99, remote software version
OpenSSH_4.6
bl-chem-iyengar3: Net::SSH::Perl Version 1.30, protocol version 2.0.
bl-chem-iyengar3: No compat match: OpenSSH_4.6.
bl-chem-iyengar3: Connection established.
bl-chem-iyengar3: Sent key-exchange init (KEXINIT), wait response.
bl-chem-iyengar3: Algorithms, c->s: 3des-cbc hmac-sha1 none
bl-chem-iyengar3: Algorithms, s->c: 3des-cbc hmac-sha1 none
bl-chem-iyengar3: Entering Diffie-Hellman Group 1 key exchange.
bl-chem-iyengar3: Sent DH public key, waiting for reply.
bl-chem-iyengar3: Received host key, type 'ssh-dss'.
bl-chem-iyengar3: Host 'arches-n1' is known and matches the host key.
bl-chem-iyengar3: Computing shared secret key.
bl-chem-iyengar3: Verifying server signature.
bl-chem-iyengar3: Waiting for NEWKEYS message.
bl-chem-iyengar3: Enabling incoming encryption/MAC/compression.
bl-chem-iyengar3: Send NEWKEYS, enable outgoing encryption/MAC/compression.
bl-chem-iyengar3: Sending request for user-authentication service.
bl-chem-iyengar3: Service accepted: ssh-userauth.
bl-chem-iyengar3: Trying empty user-authentication request.
bl-chem-iyengar3: Authentication methods that can continue:
publickey,password,keyboard-interactive,hostbased.
bl-chem-iyengar3: Next method to try is publickey.
bl-chem-iyengar3: Trying pubkey authentication with key file
'/home/xl5/.ssh/id_dsa'
bl-chem-iyengar3: Login completed, opening dummy shell channel.
bl-chem-iyengar3: channel 0: new [client-session]
bl-chem-iyengar3: Requesting channel_open for channel 0.
bl-chem-iyengar3: channel 0: open confirm rwindow 0 rmax 32768
bl-chem-iyengar3: Got channel open confirmation, requesting shell.
bl-chem-iyengar3: Requesting service shell on channel 0.
bl-chem-iyengar3: channel 1: new [client-session]
bl-chem-iyengar3: Requesting channel_open for channel 1.
bl-chem-iyengar3: Entering interactive session.
bl-chem-iyengar3: Sending command: cat > perl-ssh-test.dat.perl
bl-chem-iyengar3: Requesting service exec on channel 1.
bl-chem-iyengar3: channel 1: send eof
bl-chem-iyengar3: channel 1: open confirm rwindow 99072 rmax 32768
==================================================================================================
*when I tried to use the example script pscp to scp the same 32KB file, I
got an error message
Broken Pipe.
In the post ID 7910, someone has posted a test script to test the critical
value of the size of the data which will trigger the bug. I used this result
and found that this test script will not give consistent results at
different runs. Here I give a few different scenarios.
Case 1
======================================================================================
*Net::SSH::Perl bug test...
host=arches-n1 user=lxh remoteCmd=cat
xferChars=932779|-Error, down to 466390 chars
Received disconnect message: Corrupted MAC on input.
xferChars=466390|-Error, down to 233195 chars
Received disconnect message: Corrupted MAC on input.
xferChars=233195|-Error, down to 116598 chars
Received disconnect message: Corrupted MAC on input.
xferChars=116598|-Broken pipe
*
=======================================================================================
Case 2
=======================================================================================
*Net::SSH::Perl bug test...
host=arches-n1 user=lxh remoteCmd=cat
xferChars=932779|-Error, down to 466390 chars
Received disconnect message: Corrupted MAC on input.
xferChars=466390|-Broken pipe
*
========================================================================================
Case 3
========================================================================================
*Net::SSH::Perl bug test...
host=arches-n1 user=lxh remoteCmd=cat
xferChars=932779|-Error, down to 466390 chars
Received disconnect message: Corrupted MAC on input.
xferChars=466390|-Error, down to 233195 chars
Received disconnect message: Corrupted MAC on input.
xferChars=233195|-Error, down to 116598 chars
Received disconnect message: Corrupted MAC on input.
xferChars=116598|-Error, down to 58299 chars
Received disconnect message: Corrupted MAC on input.
xferChars=58299|-Error, down to 29150 chars
Received disconnect message: Corrupted MAC on input.
xferChars=29150|-Error, down to 14575 chars
alarm handler 10 second timeout
xferChars=14575|-OK, back up to 21862 chars
xferChars=21862|-Error, down to 18219 chars
alarm handler 10 second timeout
xferChars=18219|-Error, down to 16397 chars
alarm handler 10 second timeout
xferChars=16397|-Error, down to 15486 chars
alarm handler 10 second timeout
xferChars=15486|-OK, back up to 15941 chars
xferChars=15941|-OK, back up to 16169 chars
xferChars=16169|-OK, back up to 16283 chars
xferChars=16283|-OK, back up to 16340 chars
xferChars=16340|-OK, back up to 16368 chars
xferChars=16368|-OK, back up to 16382 chars
xferChars=16382|-OK, back up to 16389 chars
xferChars=16389|-OK, back up to 16393 chars
xferChars=16393|-OK, back up to 16395 chars
xferChars=16395|-OK, back up to 16396 chars
xferChars=16396|-OK, back up to 16396 chars
Report for remote host: arches-n1...
xferChars=16396 works, xferChars=16397 hangs on timeout=10.
exiting...
*
========================================================================================
Case 4
========================================================================================
*Net::SSH::Perl bug test...
host=arches-n1 user=lxh remoteCmd=cat
xferChars=932779|-Error, down to 466390 chars
Received disconnect message: Corrupted MAC on input.
xferChars=466390|-Error, down to 233195 chars
Received disconnect message: Corrupted MAC on input.
xferChars=233195|-Error, down to 116598 chars
Received disconnect message: Corrupted MAC on input.
xferChars=116598|-Error, down to 58299 chars
Received disconnect message: Corrupted MAC on input.
xferChars=58299|-Error, down to 29150 chars
Received disconnect message: Corrupted MAC on input.
xferChars=29150|-Error, down to 14575 chars
alarm handler 10 second timeout
xferChars=14575|-OK, back up to 21862 chars
xferChars=21862|-Error, down to 18219 chars
alarm handler 10 second timeout
xferChars=18219|-Error, down to 16397 chars
alarm handler 10 second timeout
xferChars=16397|-Error, down to 15486 chars
alarm handler 10 second timeout
xferChars=15486|-OK, back up to 15941 chars
xferChars=15941|-Error, down to 15714 chars
alarm handler 10 second timeout
xferChars=15714|-OK, back up to 15827 chars
xferChars=15827|-OK, back up to 15884 chars
xferChars=15884|-Error, down to 15856 chars
alarm handler 10 second timeout
xferChars=15856|-Error, down to 15842 chars
alarm handler 10 second timeout
xferChars=15842|-OK, back up to 15849 chars
xferChars=15849|-Error, down to 15846 chars
alarm handler 10 second timeout
xferChars=15846|-OK, back up to 15847 chars
xferChars=15847|-OK, back up to 15848 chars
xferChars=15848|-Error, down to 15848 chars
Received disconnect message: Corrupted MAC on input.
Bug did not trigger with 15848 chars on this system.
exiting...*
=======================================================================================
This bug is very confusing. As it's reported on cpanforum, it's resolved,
but in fact it's not resolved and the test script there seems to have bugs
too. it would be very helpful if you can look into this problem.
i'm using suse 10.1 with kernel 2.6.16.53-0.8-default and perl 5.8.8.
Thanks,
Xiaohu
*