New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
overlord: save fails with sockets in folder #9941
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks sensible, thanks for investigating this!
The --exclude* mechanism of tar (that you mentioned in the bug report) is pattern-based, so would only help if we extended snapshots functionality with user-defined exclusion list but I'm not sure users should be bothered with this.
@@ -396,6 +396,7 @@ func addDirToZip(ctx context.Context, snapshot *client.Snapshot, w *zip.Writer, | |||
"--create", | |||
"--sparse", "--gzip", | |||
"--format", "gnu", | |||
"--warning", "no-file-ignored", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should silently ignore the files instead of logging which were ignored.
Also, from my silly attempts with sockets in a directory, tar the same command line (but without no-file-ignored), does not exit with non-0. Then I proceeded to create sockets and fifos in $SNAP_DATA and $SNAP_COMMON of hello-world, and snap save worked. I think there may have been more errors logged by tar, but they were not included in the error output of the task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, the sockets ignored was hiding the actual cause of the error
tar: ./171/.datalayer/frontend/2069: socket ignored
tar: ./171/.datalayer/backend/2070: socket ignored
tar: ./171/package-run/rexroth-automationcore/package-www-fileserver.sock: socket ignored
tar: ./171: file changed as we read it
1
We found the cause on our side for this. But it would be helpful to have the "real" error cause in the log of the snap change.
For me it would be more the developer that should define what should be excluded during snapshot. If you have sensible data in your snap they maybe should not be part of a snapshot (since you can export them now). |
Removing my review per @bboozzoo finding (thank you!). |
Closing this for now. Looks like the root cause of the problem was caused by $SNAP_DATA directory getting modified while tar was processing it. |
When making snapshots, the snap will fail when socket files are in the directory:
This PR will ignore such warnings and will not fail the tar run:
From https://www.gnu.org/software/tar/manual/html_section/tar_27.html
Fixes: https://bugs.launchpad.net/bugs/1915781