Skip to content

Unexpected EOF/connection drop on old GlobalSCAPE server. #124

Closed

Description

@nnhanndakara

This issue has been plaguing me for months and I've run out of options. We have a vendor that we need to grab archives from every once in a while (.zip files, mostly). That vendor uses a quite aged GlobalSCAPE SFTP server to serve our files. GlobalSCAPE has never really followed the SFTP spec very well and doesn't really put much effort into making it's server compatible with OpenSSH or any of it's tools. Both the vendor and GlobalSCAPE refuse to respond to tickets on this issue, so I've been unable to determine if it's a paramiko issue or a GlobalSCAPE issue. I'm willing to bet that it's either a GlobalSCAPE issue, or both since we've only had this issue with this one server. I haven't been able to find any other server that exhibits this behavior. Even a newer version of the GlobalSCAPE server doesn't exhibit this behavior, but since I can't get anyone at either company to respond, I'm a bit stuck. The issue is 100% reproducible on the files it does file on though. The problem is that these files contain student and teacher information, so it would be a violation of too many laws to name to post the zip file so here I'm stuck.

The first of two different tracebacks I receive are:

Traceback (most recent call last):
  File "./cleanup2.py", line 18, in <module>
    c.get("/Backups/Crs/8e94c6f154/USER-0a712830-1cc5-4eba-b8a0-1e9acd1676c0.zip", "test_paramiko.zip")
      File "/usr/lib64/python2.7/site-packages/paramiko/sftp_client.py", line 614, in get
    data = fr.read(32768)
  File "/usr/lib64/python2.7/site-packages/paramiko/file.py", line 153, in read
    new_data = self._read(read_size)
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp_file.py", line 152, in _read
    data = self._read_prefetch(size)
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp_file.py", line 132, in _read_prefetch
    self.sftp._read_response()
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp_client.py", line 667, in _read_response
    raise SSHException('Server connection dropped: %s' % (str(e),))
paramiko.SSHException: Server connection dropped: 

The second is:

Traceback (most recent call last):
  File "./cleanup2.py", line 18, in <module>
    c.get("/Backups/Crs/8e94c6f154/USER-0a712830-1cc5-4eba-b8a0-1e9acd1676c0.zip", "test_paramiko.zip")
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp_client.py", line 614, in get
    data = fr.read(32768)
  File "/usr/lib64/python2.7/site-packages/paramiko/file.py", line 153, in read
    new_data = self._read(read_size)
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp_file.py", line 152, in _read
    data = self._read_prefetch(size)
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp_file.py", line 132, in _read_prefetch
    Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib64/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp_file.py", line 453, in _prefetch_thread
    self.sftp._async_request(self, CMD_READ, self.handle, long(offset), int(length))
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp_client.py", line 656, in _async_request
    self._send_packet(t, str(msg))
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp.py", line 172, in _send_packet
    self._write_all(out)
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp.py", line 138, in _write_all
    raise EOFError()
EOFError

self.sftp._read_response()
  File "/usr/lib64/python2.7/site-packages/paramiko/sftp_client.py", line 667, in _read_response
    raise SSHException('Server connection dropped: %s' % (str(e),))
paramiko.SSHException: Server connection dropped: 

Activity

  1. bitprophet commented on Apr 25, 2016

    @bitprophet
    Member

    Possibly related to #444 (and thus also possibly fixed in the interim). Closing as "old & no activity" for now.

  2. zachliu commented on Apr 15, 2019

    @zachliu

    Using the latest paramiko 2.4.2, I have exactly the opposite issue 😂. In my case, our vendor switched their SFTP provider from Globalscape (SSH-2.0-1.82_sshlib Globalscape) to Cerberus (SSH-2.0-CerberusFTPServer_10.0) a few days ago. Ever since then, paramiko has been unable to download a ~400MB file.

    Here is the symptom:
    The downloading speed is extremely slow. After downloading 20~30MB, it always errors out with:
    Server connection dropped msg.

    Here is the log (Globalscape) - successful download:

    "paramiko.transport", "DEBUG", "starting thread (client mode): 0x160096d8"
    "paramiko.transport", "DEBUG", "Local version/idstring: SSH-2.0-paramiko_2.4.1"
    "paramiko.transport", "DEBUG", "Remote version/idstring: SSH-2.0-1.82_sshlib Globalscape"
    "paramiko.transport", "INFO", "Connected (version 2.0, client 1.82_sshlib)"
    "paramiko.transport", "DEBUG", "kex algos:['diffie-hellman-group14-sha1', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa'] client encrypt:['twofish256-cbc', 'twofish-cbc', 'twofish128-cbc', 'blowfish-cbc', '3des-cbc', 'arcfour', 'cast128-cbc', 'aes256-cbc', 'aes128-cbc', 'aes256-ctr', 'aes128-ctr'] server encrypt:['twofish256-cbc', 'twofish-cbc', 'twofish128-cbc', 'blowfish-cbc', '3des-cbc', 'arcfour', 'cast128-cbc', 'aes256-cbc', 'aes128-cbc', 'aes256-ctr', 'aes128-ctr'] client mac:['hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['zlib', 'none'] server compress:['zlib', 'none'] client lang:[''] server lang:[''] kex follows?False"
    "paramiko.transport", "DEBUG", "HostKey agreed: ssh-rsa"
    "paramiko.transport", "DEBUG", "Cipher agreed: aes128-ctr"
    "paramiko.transport", "DEBUG", "MAC agreed: hmac-sha1"
    "paramiko.transport", "DEBUG", "Compression agreed: none"
    "paramiko.transport", "DEBUG", "Got server p (2048 bits)"
    "paramiko.transport", "DEBUG", "kex engine KexGex specified hash_algo <built-in function openssl_sha1>"
    "paramiko.transport", "DEBUG", "Switch to new keys ..."
    "paramiko.transport", "DEBUG", "Attempting public-key auth..."
    "paramiko.transport", "DEBUG", "userauth is OK"
    "paramiko.transport", "INFO", "Auth banner: b'Welcome to the our Secure FTP Server'"
    "paramiko.transport", "INFO", "Authentication (publickey) successful!"
    "paramiko.transport", "DEBUG", "[chan 0] Max packet in: 32768 bytes"
    "paramiko.transport", "DEBUG", "[chan 0] Max packet out: 35840 bytes"
    "paramiko.transport", "DEBUG", "Secsh channel 0 opened."
    "paramiko.transport", "DEBUG", "[chan 0] Sesch channel 0 request ok"
    "paramiko.transport.sftp", "INFO", "[chan 0] Opened sftp connection (server version 3)"
    "paramiko.transport.sftp", "DEBUG", "[chan 0] stat(b'data.csv')"
    "paramiko.transport.sftp", "DEBUG", "[chan 0] open(b'data.csv', 'rb')"
    "paramiko.transport.sftp", "DEBUG", "[chan 0] open(b'data.csv', 'rb') -> 31"
    "paramiko.transport.sftp", "DEBUG", "[chan 0] close(31)"
    "paramiko.transport.sftp", "INFO", "[chan 0] sftp session closed."
    "paramiko.transport", "DEBUG", "[chan 0] EOF sent (0)"
    "paramiko.transport", "DEBUG", "EOF in transport thread"
    

    Here is the log (Cerberus) - failed download:

    "paramiko.transport", "DEBUG", "starting thread (client mode): 0x119706d8"
    "paramiko.transport", "DEBUG", "Local version/idstring: SSH-2.0-paramiko_2.4.1"
    "paramiko.transport", "DEBUG", "Remote version/idstring: SSH-2.0-CerberusFTPServer_10.0"
    "paramiko.transport", "INFO", "Connected (version 2.0, client CerberusFTPServer_10.0)"
    "paramiko.transport", "DEBUG", "kex algos:['ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa'] client encrypt:['aes128-ctr', 'aes128-cbc', 'aes192-ctr', 'aes192-cbc', 'aes256-ctr', 'aes256-cbc', '3des-cbc'] server encrypt:['aes128-ctr', 'aes128-cbc', 'aes192-ctr', 'aes192-cbc', 'aes256-ctr', 'aes256-cbc', '3des-cbc'] client mac:['hmac-sha1', 'hmac-sha1-96', 'hmac-sha2-256', 'hmac-sha2-256-96', 'hmac-sha2-512', 'hmac-sha2-512-96', 'hmac-ripemd160', '[email protected]', 'hmac-md5'] server mac:['hmac-sha1', 'hmac-sha1-96', 'hmac-sha2-256', 'hmac-sha2-256-96', 'hmac-sha2-512', 'hmac-sha2-512-96', 'hmac-ripemd160', '[email protected]', 'hmac-md5'] client compress:['none'] server compress:['none'] client lang:['en-US'] server lang:['en-US'] kex follows?False"
    "paramiko.transport", "DEBUG", "Kex agreed: ecdh-sha2-nistp256"
    "paramiko.transport", "DEBUG", "HostKey agreed: ssh-rsa"
    "paramiko.transport", "DEBUG", "Cipher agreed: aes128-ctr"
    "paramiko.transport", "DEBUG", "MAC agreed: hmac-sha2-256"
    "paramiko.transport", "DEBUG", "Compression agreed: none"
    "paramiko.transport", "DEBUG", "kex engine KexNistp256 specified hash_algo <built-in function openssl_sha256>"
    "paramiko.transport", "DEBUG", "Switch to new keys ..."
    "paramiko.transport", "DEBUG", "Attempting public-key auth..."
    "paramiko.transport", "DEBUG", "userauth is OK"
    "paramiko.transport", "INFO", "Authentication (publickey) successful!"
    "paramiko.transport", "DEBUG", "[chan 0] Max packet in: 32768 bytes"
    "paramiko.transport", "DEBUG", "[chan 0] Max packet out: 32768 bytes"
    "paramiko.transport", "DEBUG", "Secsh channel 0 opened."
    "paramiko.transport", "DEBUG", "[chan 0] Sesch channel 0 request ok"
    "paramiko.transport.sftp", "INFO", "[chan 0] Opened sftp connection (server version 3)"
    "paramiko.transport.sftp", "DEBUG", "[chan 0] stat(b'data.csv')"
    "paramiko.transport.sftp", "DEBUG", "[chan 0] open(b'data.csv', 'rb')"
    "paramiko.transport.sftp", "DEBUG", "[chan 0] open(b'data.csv', 'rb') -> 7b45394343333830462d383832352d343436342d393831302d4444373838314237303433367d"
    "paramiko.transport", "DEBUG", "EOF in transport thread"
    
  3. zachliu commented on Apr 15, 2019

    @zachliu

    @kaorihinata @bitprophet I think I'm going to give up paramiko. Maybe I'll start using sftp command in a Python subprocess call. Do you have any suggestions?

  4. zachliu commented on Apr 17, 2019

    @zachliu

    Update:
    I had to add

    transport.default_window_size = paramiko.common.MAX_WINDOW_SIZE
    

    as a workaround based on this post. Too much trouble working with Paramiko, I'm switching to sftp command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions