Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#44 closed defect (fixed)

Don't use timed-out child sessions for remote files

Reported by: schwa Owned by: schwa
Priority: minor Milestone: 2.5
Component: Library Version: 2.4.2
Keywords: open, file, child session, timeout Cc:


When requesting a file-like object with open or file, or implicitly by using one of the upload or download methods, ftputil uses a "child session" behind the scenes, i. e. it implicitly makes a new connection to the FTP server. If a remote file has been opened and closed before, the associated FTP session is reused. At the moment, however, this is done without checking if the connection has already timed out.

I've never heard of actual problems regarding this behavior, but it isn't correct and could lead to mysterious surprises if it's triggered.

I'm planning to remedy this by doing a getcwd call on a child session before reusing it. If that turns out to be roughly as slow as building a new session in the first place, I'll consider to get rid of the session caching altogether, thereby simplifying the code a bit.

Change History (3)

comment:1 Changed 11 years ago by schwa

Milestone: 2.5

comment:2 Changed 11 years ago by schwa

Resolution: fixed
Status: newclosed

Fixed in revision [22f536ed0c57].

comment:3 Changed 11 years ago by schwa

I decided against removing the child cache as it will most likely save a lot of time if files are requested frequently (e. g. during series of uploads or downloads). This is especially true if the files are rather small, because then the time to re-establish a server connection would be relatively large with respect to the transfer time.

Note: See TracTickets for help on using tickets.