#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/host.py", line 523, in download
    conditional=False, callback=callback)
  File "/usr/lib/python3.6/site-packages/ftputil/file_transfer.py", line 182, in copy_file
    source_fobj = source_file.fobj()
  File "/usr/lib/python3.6/site-packages/ftputil/file_transfer.py", line 94, in fobj
    return self._host.open(self.name, self.mode)
  File "/usr/lib/python3.6/site-packages/ftputil/host.py", line 203, in open
    host = self._available_child()
  File "/usr/lib/python3.6/site-packages/ftputil/host.py", line 167, in _available_child
    host._session.pwd()
  File "/usr/lib64/python3.6/ftplib.py", line 654, in pwd
    resp = self.voidcmd('PWD')
  File "/usr/lib64/python3.6/ftplib.py", line 276, in voidcmd
    return self.voidresp()
  File "/usr/lib64/python3.6/ftplib.py", line 249, in voidresp
    resp = self.getresp()
  File "/usr/lib64/python3.6/ftplib.py", line 234, in getresp
    resp = self.getmultiline()
  File "/usr/lib64/python3.6/ftplib.py", line 220, in getmultiline
    line = self.getline()
  File "/usr/lib64/python3.6/ftplib.py", line 208, in getline
    raise EOFError

Change History (6)

comment:1 Changed 14 months ago by schwa

  • Description modified (diff)
  • Keywords ftplib EOFError _available_child added
  • Status changed from new to assigned

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

comment:2 Changed 14 months 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 14 months ago by ftputiluser

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

Then we used fptHost.download 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 14 months ago by schwa

  • Milestone set to 3.4

comment:5 Changed 14 months ago by schwa

I tried the following code to reproduce the error:

import ftputil


with ftputil.FTPHost("208.74.245.143", "anonymous", "me@here.org") as host:
    host.download("/CompanyManager/Quickbooks (10).2/MF/C/Program Files (x86)/"
                  "Common Files/Intuit/Sync/Sybase10/mlrsa10.dll",
                  "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 14 months ago by schwa

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in [b2e19844d663].

Note: See TracTickets for help on using tickets.