gpg randomly fails (lp:#1589226)

[Original report](https://bugs.launchpad.net/bugs/1589226) created by **John (johnniedoe)**
```
I have ca 20 GB folder I want to backup into s3. I used to do it without
any problems on ubuntu 14.04/16.04 but after migrating to arch it seems
impossible.
I'm using duply and whole backup starts as usual, asks me for GPG password
and starts uploading volumes (with 'success' messages) but after an hour or
so every time I got this message (even though that at the very start of
whole procedure duply/duplicity actually tests whether or not it can
encrypt, sign and decrypt so I don't get why it can't after uploading over
150 volumes..). It's not connected with any specific volume/folder/file
beeing backed up.

[...]
Registering (mktemp) temporary file /tmp/duplicity-fCBKtp-tempdir/mktemp-
Mste0K-168
AsyncScheduler: running task synchronously (asynchronicity disabled)
Writing duplicity-full.20160604T205531Z.vol167.difftar.gpg
Uploading s3://s3-eu-
west-1.amazonaws.com/johnniedoe_bucket/backup/duplicity-
full.20160604T205531Z.vol167.difftar.gpg to STANDARD Storage
Uploaded s3://s3-eu-
west-1.amazonaws.com/johnniedoe_bucket/backup/duplicity-
full.20160604T205531Z.vol167.difftar.gpg to STANDARD Storage at roughly
719776.112915 bytes/second
Deleting /tmp/duplicity-fCBKtp-tempdir/mktemp-Mste0K-168
Forgetting temporary file /tmp/duplicity-fCBKtp-tempdir/mktemp-Mste0K-168
AsyncScheduler: task completed successfully
Processed volume 167
Registering (mktemp) temporary file /tmp/duplicity-fCBKtp-tempdir/mktemp-
Vh1Nwa-169
Releasing lockfile /home/johnniedoe/.cache/duplicity/duply_s3/lockfile.lock
Removing still remembered temporary file /tmp/duplicity-fCBKtp-
tempdir/mktemp-Vh1Nwa-169
Removing still remembered temporary file /tmp/duplicity-fCBKtp-
tempdir/mkstemp-O2x7AF-1
GPG error detail: Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1537, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1531, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1385, in main
    do_backup(action)
  File "/usr/bin/duplicity", line 1506, in do_backup
    full_backup(col_stats)
  File "/usr/bin/duplicity", line 572, in full_backup
    globals.backend)
  File "/usr/bin/duplicity", line 430, in write_multivol
    at_end = gpg.GPGWriteFile(tarblock_iter, tdp.name, globals.gpg_profile,
globals.volsize)
  File "/usr/lib/python2.7/site-packages/duplicity/gpg.py", line 356, in
GPGWriteFile
    file.close()
  File "/usr/lib/python2.7/site-packages/duplicity/gpg.py", line 241, in
close
    self.gpg_failed()
  File "/usr/lib/python2.7/site-packages/duplicity/gpg.py", line 226, in
gpg_failed
    raise GPGError(msg)
GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: using ">MYKEYID<" as default secret key for signing
gpg: signing failed: Operation cancelled
gpg: [stdin]: sign+encrypt failed: Operation cancelled
===== End GnuPG log =====

GPGError: GPG Failed, see log below:
===== Begin GnuPG log =====
gpg: using "FE6BA5E6" as default secret key for signing
gpg: signing failed: Operation cancelled
gpg: [stdin]: sign+encrypt failed: Operation cancelled
===== End GnuPG log =====

00:56:39.570 Task 'BKP' failed with exit code '31'.
--- Finished state FAILED 'code 31' at 00:56:39.570 - Runtime 02:01:10.105
---

--- Start running command POST at 00:56:39.590 ---
Skipping n/a script '/home/johnniedoe/.duply/s3/post'.
--- Finished state OK at 00:56:39.608 - Runtime 00:00:00.017 ---

Using installed duplicity version 0.7.07.1, python 2.7.11, gpg 2.1.12
(Home: ~/.gnupg), awk 'GNU Awk 4.1.3, API: 1.1 (GNU MPFR 3.1.4-p1, GNU MP
6.1.0)', grep 'grep (GNU grep) 2.25', bash '4.3.42(1)-release
(x86_64-unknown-linux-gnu)'.
Linux 4.5.4-1-ARCH #1 SMP PREEMPT Wed May 11 22:21:28 CEST 2016 x86_64
GNU/Linux
```

Story points: 6.0