pysftp Exception: Expecting packet from (31,), got 94



好吧,我自问自答了

http://stackoverflow.com/questions/29223790/paramiko-ssh-exception-sshexception-expecting-packet-from-31-got-94/29257625#29257625


When I use pysftp-0.2.8 to send a Large files to my sftp service. it always got the same error:paramiko.ssh_exception.SSHException: Expecting packet from (31,), got 94

The file is about 1.5G , when it transfers at 500M, it break.code here:

import pysftp
upftp=FTP(host=ftp_ip, user=ftp_name, passwd=ftp_passwd, acct=ftp_port, timeout=None)
...

try:
    upftp.storbinary('STOR %s'%obj[2], fp, 8192, self.callpecent)      
except Exception as error:
    fp.close()
    self.endit(upftp, 1, '%s,%s'%(obj[2],error), '%s,%s'%(obj[2],error)

)

the error message at here:

2015-03-24 09:43:05  DEBUG - Rekeying (hit 32729 packets, 536900100 bytes sent)

2015-03-24 09:43:05  DEBUG - Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
2015-03-24 09:43:05  DEBUG - using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
2015-03-24 09:43:05  ERROR - Exception: Expecting packet from (31,), got 94
2015-03-24 09:43:05  ERROR - Traceback (most recent call last):
2015-03-24 09:43:05  ERROR -   File "D:\Python34\lib\site-packages\paramiko-1.14.0-py3.4.egg\paramiko\transport.py", line 1435, in run
2015-03-24 09:43:05  ERROR -     raise SSHException('Expecting packet from %r, got %d' % (self._expected_packet, ptype))
2015-03-24 09:43:05  ERROR - paramiko.ssh_exception.SSHException: Expecting packet from (31,), got 94
2015-03-24 09:43:05  ERROR - 
2015-03-24 09:43:05  DEBUG - Dropping user packet because connection is dead.
2015-03-24 09:43:05  DEBUG - [chan 1] close(b'd40b000000000000')
2015-03-24 09:43:05  INFO - [chan 1] sftp session closed.



I find somethings may be useful :)

in the paramiko/packet.py

REKEY_PACKETS = pow(2, 29)
REKEY_BYTES = pow(2, 29)

REKEY_PACKETS_OVERFLOW_MAX = pow(2, 29)     # Allow receiving this many packets after a re-key request before terminating
REKEY_BYTES_OVERFLOW_MAX = pow(2, 29)       # Allow receiving this many bytes after a re-key request before terminating

and

    def _trigger_rekey(self):
    # outside code should check for this flag
    self.__need_rekey = True

when it use the re-key ,it goes wrong.


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值