restic: Backblaze B2 unexpected end of JSON input
Output of restic version
restic 0.7.3
compiled with go1.9 on linux/amd64
How did you run restic exactly?
I tried to back up some fairly large (~ 200GB in total) VM images using restic using
restic backup --force /mnt/backup/dump/
I used these environment variables:
RESTIC_REPOSITORY "b2:<bucket_name:<path_to_backup>"
B2_ACCOUNT_ID="<some_account_id>"
B2_ACCOUNT_KEY "<some_account_key"
RESTIC_PASSWORD "<very_secret_password>"
I tried this multiple times, but restic always fails with an error after < 30 minutes.
error while saving data to the repo: unexpected end of JSON input
Close
github.com/restic/restic/internal/backend/b2.(*b2Backend).Save
src/github.com/restic/restic/internal/backend/b2/b2.go:250
github.com/restic/restic/internal/repository.(*Repository).savePacker
src/github.com/restic/restic/internal/repository/packer_manager.go:122
github.com/restic/restic/internal/repository.(*Repository).SaveAndEncrypt
src/github.com/restic/restic/internal/repository/repository.go:203
github.com/restic/restic/internal/repository.(*Repository).SaveBlob
src/github.com/restic/restic/internal/repository/repository.go:529
github.com/restic/restic/internal/archiver.(*Archiver).Save
src/github.com/restic/restic/internal/archiver/archiver.go:104
github.com/restic/restic/internal/archiver.(*Archiver).saveChunk
src/github.com/restic/restic/internal/archiver/archiver.go:161
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:2337
panic: Close: unexpected end of JSON input
goroutine 40839 [running]:
github.com/restic/restic/internal/archiver.(*Archiver).saveChunk(0xc4202ca1e0, 0xdff020, 0xc4200140c8, 0x619ae385, 0x12516a, 0x1b98a15d300000, 0xc4333fa000, 0x12516a, 0x5e4000, 0xc420080840, ...)
src/github.com/restic/restic/internal/archiver/archiver.go:166 +0x41b
created by github.com/restic/restic/internal/archiver.(*Archiver).SaveFile
src/github.com/restic/restic/internal/archiver/archiver.go:240 +0x3d0
What backend/server/service did you use?
Backlaze B2
Expected behavior
I’d like restic to finish the backup without an error or aborting.
Actual behavior
The backup fails with an error every time.
Steps to reproduce the behavior
- Setup a restic repository on Backblaze B2
- Backup a folder with some large files (~ 200GB across 20 files in my case)
- Observe error message
Do you have any idea what may have caused this?
I found some issues only with a similar error. It seems, that this is caused by a invalid API response from B2. In the linked post the solution was to retry the backup, but this does not work in my case. The backup fails every time.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 42 (30 by maintainers)
I cannot see new messages concerning retries (similar for check and prune):
restic-master -r $B2_REPO rebuild-index password is correct counting files in repo [19:48] 100.00% 2683 / 2683 packs finding old index files saved new index as 3e556787 remove 11 old index files
The random errors “error while saving data to the repo: unexpected end of JSON input” are just gone. So it seems to work well. In general i like the messages restic prints. 😉
According to the Integration Checklist mentioned above there is a header X-Bz-Test-Mode: fail_some_uploads which can be used to test the backend. Blazer seems to support this as a client option.
https://www.backblaze.com/b2/docs/integration_checklist.html
This page says the upload should be attempted again if there is a 503.