~sschwarzer/ftputil#52: 
Main FTPHost session times out while downloading a large file

If an upload or download is started whose duration exceeds the timeout setting of the server, the main FTP session which spawned the child session will time out even though the upload/download will succeed. That is, any direct access (that works on the server) to the original FTPHost object will result in a traceback.

(problem ​reported by Henning Hraban Ramm)

Status
RESOLVED INVALID
Submitter
schwa (unverified)
Assigned to
No-one
Submitted
13 years ago
Updated
13 years ago
Labels
bug library

schwa (unverified) 13 years ago · edit

The traceback gotten by Henning is

Traceback (most recent call last):
  File "./ftpsync.py", line 388, in <module>
    host.rename(sourcepath, host.path.join(root, abgeholtdir, f))
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ftputil-2.4.2-py2.6.egg/ftputil/ftputil.py", line 746, in rename
    self._check_inaccessible_login_directory()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ftputil-2.4.2-py2.6.egg/ftputil/ftputil.py", line 535, in _check_inaccessible_login_directory
    self.chdir(presumable_login_dir)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ftputil-2.4.2-py2.6.egg/ftputil/ftputil.py", line 587, in chdir
    ftp_error._try_with_oserror(self._session.cwd, path)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ftputil-2.4.2-py2.6.egg/ftputil/ftp_error.py", line 146, in _try_with_oserror
    raise TemporaryError(*exc.args)
ftputil.ftp_error.TemporaryError: 421 No Transfer Timeout (300 seconds): closing control connection.
Debugging info: ftputil 2.4.2, Python 2.6.4 (darwin)

and he adds:

The mentioned line (host.rename) is right after: host.download_if_newer(sourcepath, targetpath, mode='b') with host being a ftputil.FTPHost

schwa (unverified) 13 years ago · edit

In my opinion, this isn't a defect in ftputil because FTP servers are free to let connections time out.

I agree, though, that ftputil's behavior may seem confusing. Some background is ​provided here.

schwa (unverified) 13 years ago · edit

To make it easier to keep the connection alive, I've added a keep_alive method in revision a7ceaef3cab1c453f9729258fcbfc92ecfd7ae8f. Note that this only works on the "main" connection of the FTPHost instance. It will not help if a child session times out during a file transfer.

ftputiluser (unverified) 9 years ago · edit

as the links to the mailing list are no longer valid, but the information provided is quite good: ​the original report and the ​backround

Register here or Log in to comment, or comment via email.