Opened 4 years ago

Closed 4 years ago

#114 closed defect (fixed)

Uncaught EOF error in host._avaliable_child

Reported by: ftputiluser Owned by: schwa
Priority: major Milestone: 3.4
Component: Library Version:
Keywords: ftplib EOFError _available_child Cc:

Description (last modified by schwa)

There is an uncaught ftplib EOF exception in _avaliable_child that does not get transformed to standard FTPUtil errors.

File "/usr/lib/python3.6/site-packages/ftputil/", line 523, in download
    conditional=False, callback=callback)
  File "/usr/lib/python3.6/site-packages/ftputil/", line 182, in copy_file
    source_fobj = source_file.fobj()
  File "/usr/lib/python3.6/site-packages/ftputil/", line 94, in fobj
    return, self.mode)
  File "/usr/lib/python3.6/site-packages/ftputil/", line 203, in open
    host = self._available_child()
  File "/usr/lib/python3.6/site-packages/ftputil/", line 167, in _available_child
  File "/usr/lib64/python3.6/", line 654, in pwd
    resp = self.voidcmd('PWD')
  File "/usr/lib64/python3.6/", line 276, in voidcmd
    return self.voidresp()
  File "/usr/lib64/python3.6/", line 249, in voidresp
    resp = self.getresp()
  File "/usr/lib64/python3.6/", line 234, in getresp
    resp = self.getmultiline()
  File "/usr/lib64/python3.6/", line 220, in getmultiline
    line = self.getline()
  File "/usr/lib64/python3.6/", line 208, in getline
    raise EOFError

Change History (6)

comment:1 Changed 4 years ago by schwa

Description: modified (diff)
Keywords: ftplib EOFError _available_child added
Status: newassigned

Thanks for the report! I think I'll look into it on Saturday.

comment:2 Changed 4 years ago by schwa

Do you have a small example script to reproduce the problem? I'd like to see why an EOFError would be raised in pwd.

comment:3 Changed 4 years ago by ftputiluser

Don't have a script right now, what we did is to first connect to as annonymous.

Then we used to try to download /CompanyManager/Quickbooks? (10).2/MF/C/Program Files (x86)/Common Files/Intuit/Sync?/Sybase10/mlrsa10.dll

That's when this came up.

comment:4 Changed 4 years ago by schwa

Milestone: 3.4

comment:5 Changed 4 years ago by schwa

I tried the following code to reproduce the error:

import ftputil

with ftputil.FTPHost("", "anonymous", "") as host:"/CompanyManager/Quickbooks (10).2/MF/C/Program Files (x86)/"
                  "Common Files/Intuit/Sync/Sybase10/mlrsa10.dll",

However, in three runs of this code I wasn't able to reproduce the traceback. The download succeeded without any errors.

That said, this error looks somewhat similar to that in ticket #112, although there's a difference. In ticket #112, self.file.readline in getline raises an OSError whereas here, in ticket #114, the readline call succeeds and the following check if not line raises an EOFError.

The comment for the getline method is interesting:

# Raise EOFError if the connection is closed

I assume the server closed the connection at some point while downloading many files.

Usually, I don't add exception handling code because of an assumption and not even being able to reproduce an error. However, _available_child already catches several exceptions and the pwd call in _available_child is an implementation detail whose exceptions the user shouldn't have to deal with. Therefore, I'll catch EOFError there in addition to ftplib.error_temp, ftplib.error_reply and OSError.

comment:6 Changed 4 years ago by schwa

Resolution: fixed
Status: assignedclosed

Fixed in [b2e19844d663].

Note: See TracTickets for help on using tickets.