Ticket #52 (closed defect: invalid)

Opened 3 years ago

Last modified 3 years ago

Main FTPHost session times out while downloading a large file

Reported by: schwa Owned by: schwa
Priority: major Milestone: 2.5
Component: Library Version:
Keywords: timeout, main, child, session Cc:

Description

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)

Change History

comment:1 Changed 3 years ago by schwa

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

comment:2 Changed 3 years ago by schwa

  • Status changed from new to closed
  • Resolution set to invalid

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.

comment:3 Changed 3 years ago by schwa

To make it easier to keep the connection alive, I've added a keep_alive method in revision [ac645c973d1b]. 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.

Note: See TracTickets for help on using tickets.