Skip to content

fix(volume-backups): accept tar exit 1 when backing up live volumes - #5800

Merged
narcisonunez merged 1 commit into
Dokploy:canaryfrom
Souvik-Cyclic:fix/volume-backup-live-tar-5792
Oct 30, 2026
Merged

narcisonunez merged 1 commit into
Dokploy:canaryfrom
Souvik-Cyclic:fix/volume-backup-live-tar-5792

Conversation

@Souvik-Cyclic

@Souvik-Cyclic Souvik-Cyclic commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What is this PR about?

backupVolume (packages/server/src/utils/volume-backups/backup.ts) runs tar cvf under set -e. GNU tar exits with 1 when a file changes while it is being read, which is normal for a volume that is still being written, so a backup with "Turn off container" disabled stopped at tar: ./<file>: file changed as we read it and never uploaded (#5792). For services that write continuously, turning off the container was the only mode that worked.

This accepts tar exit 1 and still fails on 2 or higher. The $? is escaped so it is evaluated inside the container's bash -c; unescaped, the outer shell would expand it first and the check would always fail. tar still prints the warning, so the log shows which files changed.

Verified with new tests in apps/dokploy/__test__/backups/volume-backup-tar-exit.test.ts that run the command generated by backupVolume with tar stubbed to exit 1 (the backup uploads) and 2 (it fails without uploading). The first fails on canary and passes with this change. Also checked against a real volume with a container appending to a 300 MB file: on canary the backup stops after the tar warning, and with this change it continues to the upload and cleanup.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related (if applicable)

closes #5792

Screenshots (if applicable)

N/A - covered by unit tests for the generated backup command.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

The PR lets volume backups continue when GNU tar reports that files changed while being read.

  • Live volume backups continue after tar reports a changing file.

Reviews (1) · Last reviewed commit: "fix: accept tar exit 1 in live volume ba..." · Reviewed by Greptile

@Souvik-Cyclic Souvik-Cyclic changed the title fix: accept tar exit 1 in live volume backups fix(volume-backups): accept tar exit 1 when backing up live volumes Oct 27, 2026
@narcisonunez
narcisonunez merged commit 0cfa2f6 into Dokploy:canary Oct 30, 2026
5 checks passed
@Souvik-Cyclic
Souvik-Cyclic deleted the fix/volume-backup-live-tar-5792 branch October 30, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Volume backup without Turn Off Container fails on any volume that is being written

2 participants