g3492 / vzborg

Simple deduplicated encrypted backups for Proxmox
GNU Affero General Public License v3.0
55 stars 15 forks source link

vzborg restore fails for slow borg repositories #11

Closed bnbartekc closed 3 years ago

bnbartekc commented 3 years ago

In our environment we have a borg repository setup on NFS filesystem. When issuing vzborg restore for very small images everything works fine but for images of size 50+GB (with actual data being about 26+GB) command fails with following message:

vzborg: > Restoring backup vzborg-106-2021_08_04-03_51_15.vma as VM 106 to storage new_storage restore vma archive: vma extract -v -r /var/tmp/vzdumptmp32468.fifo - /var/tmp/vzdumptmp32468 command 'set -o pipefail && vma extract -v -r /var/tmp/vzdumptmp32468.fifo - /var/tmp/vzdumptmp32468' failed: got timeout Local Exception Traceback (most recent call last): File "/usr/lib/python3/dist-packages/borg/archiver.py", line 4455, in main exit_code = archiver.run(args) File "/usr/lib/python3/dist-packages/borg/archiver.py", line 4387, in run return set_ec(func(args)) File "/usr/lib/python3/dist-packages/borg/archiver.py", line 154, in wrapper return method(self, args, repository=repository, kwargs) File "/usr/lib/python3/dist-packages/borg/archiver.py", line 167, in wrapper return method(self, args, repository=repository, manifest=manifest, key=key, archive=archive, kwargs) File "/usr/lib/python3/dist-packages/borg/archiver.py", line 765, in do_extract stripped_components=strip_components, original_path=orig_path, pi=pi) File "/usr/lib/python3/dist-packages/borg/archive.py", line 559, in extract_item sys.stdout.buffer.write(data) BrokenPipeError: [Errno 32] Broken pipe

Platform: Linux ns31375752 5.4.106-1-pve #1 SMP PVE 5.4.106-1 (Fri, 19 Mar 2021 11:08:47 +0100) x86_64 Linux: debian 10.9 Borg: 1.1.9 Python: CPython 3.7.3 PID: 32433 CWD: /etc/vzborg sys.argv: ['/usr/bin/borg', 'extract', '--stdout', '/mnt/pve/nfs_backups/borg::vzborg-106-2021_08_04-03_51_15.vma'] SSH_ORIGINAL_COMMAND: None

It seems that qmrestore waits a very short time for data to appear on STDIN before closing so when borg takes longer to start sending data this error occurs. This is further confirmed by the fact I managed to circumvent the error by introducing artificial delay before running qmrestore via sleep command with adjustable sleep time. Will fork and submit pull request once I figure git out. Edit: And pull request created #12