Freeze when remote host has closed the connection (FTP backup) (lp:#746377)

[Original report](https://bugs.launchpad.net/bugs/746377) created by **Anakin Starkiller (sunrider)**
```
I use duplicity to backup a large amount of data to a FTP server (the one
provided by my ISP, so I don't have any control over this server).
After a while, I've got an error because the remote host has closed the
connection...



--------------------------------------------------------------------
/duplicity-EaIobp-tempdir/mktemp-bSUbxB-13' 'duplicity-
full.20110330T144033Z.vol51.difftar.gpg'' failed with code 3 (attempt #1)
Error is:
Lost data connection to remote host after 12025856 bytes had been sent:
Broken pipe.
Remote host has closed the connection.
ncftpput duplicity-full.20110330T144033Z.vol51.difftar.gpg: socket write
error.

^C

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1249, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1242, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1215, in main
    full_backup(col_stats)
  File "/usr/bin/duplicity", line 417, in full_backup
    globals.backend)
  File "/usr/bin/duplicity", line 316, in write_multivol
    (tdp, dest_filename)))
  File "/usr/lib/python2.7/site-packages/duplicity/asyncscheduler.py", line
145, in schedule_task
    return self.__run_synchronously(fn, params)
  File "/usr/lib/python2.7/site-packages/duplicity/asyncscheduler.py", line
171, in __run_synchronously
    ret = fn(*params)
  File "/usr/bin/duplicity", line 315, in <lambda>
    async_waiters.append(io_scheduler.schedule_task(lambda tdp,
dest_filename: put(tdp, dest_filename),
  File "/usr/bin/duplicity", line 241, in put
    backend.put(tdp, dest_filename)
  File "/usr/lib/python2.7/site-packages/duplicity/backends/ftpbackend.py",
line 98, in put
    self.run_command_persist(commandline)
  File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 382,
in run_command_persist
    return self.subprocess_popen_persist(commandline)
  File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 440,
in subprocess_popen_persist
    result, stdout, stderr = self._subprocess_popen(commandline)
  File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 403,
in _subprocess_popen
    stdout, stderr = p.communicate()
  File "/usr/lib/python2.7/subprocess.py", line 740, in communicate
    return self._communicate(input)
  File "/usr/lib/python2.7/subprocess.py", line 1257, in _communicate
    stdout, stderr = self._communicate_with_poll(input)
  File "/usr/lib/python2.7/subprocess.py", line 1311, in
_communicate_with_poll
    ready = poller.poll()
KeyboardInterrupt

------------------------

As you can see, I have to press control-C to exit the program.

Fortunately, my volsize is small enough (15Mb), so I just have to launch
duplicity again, and it will resume the transfer almost where it was
stopped.

So the question is : what can I do to automate this ? Or maybe, duplicity
should not freeze at all in the first place...
```
Original tags: backup closed connection duplicity freeze ftp host remote retries

Story points: 6.0