Opened 9 years ago

Closed 9 years ago

Last modified 5 years ago

#52 closed defect (invalid)

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 (4)

comment:1 Changed 9 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 9 years ago by schwa

Resolution: invalid
Status: newclosed

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 9 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.

comment:4 Changed 5 years ago by ftputiluser

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

Note: See TracTickets for help on using tickets.