-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
podman-machine-default.json gets corrupted on improper Windows shutdown #18011
Comments
Thanks for reaching out, @nefarius! @ashley-cui @baude PTAL |
@n1hility ideas? |
The WSL backend writes the file atomically (i.e., into a tmp file and then does a rename). The QEMU backend does not and writes directly (should be fixed). @nefarius which backend are you using? |
@vrothberg windows only supports the WSL backend at the moment. |
Using WSL2. |
Ah, "Even within the same directory, on non-Unix platforms Rename is not an atomic operation" (see os.Rename docs). |
@n1hility, is it even possible to atomically-rename a file on Windows? golang/go#22397 (comment) |
OK, Windows has a syscall for it that is being used in https://github.com/natefinch/atomic |
@vrothberg golang uses MOVEFILE_REPLACE_EXISTING since golang 1.5: https://github.com/golang/go/blob/master/src/internal/syscall/windows/syscall_windows.go#L317 (same mechanism as in that library) If the underlying file system is NTFS, and its on the same volume, its a metadata write which is atomic. However its not atomic/transacted relative to the previous tmp write. Looking at it we aren't flushing there so thats a problem, will do a patch there. |
It just happened again 🤣 but hey, good news, I found the faulty driver in the meantime; it's not my own but the GPU drivers causing the crash, yay! 🎉 |
Glad to here @nefarius! Note the linked PR is only one of two parts. While testing various system failures, I was able to trigger a similar problem to containers.conf which is written to during init (less common than the vm conf updates, which happen on all life cycle operations, but still a concern). The second issue will require a patch to containers/common |
Not fully fixed yet, one more PR to go |
Issue Description
The file
C:\Users\<username>\.config\containers\podman\machine\wsl\podman-machine-default.json
gets corrupted (basically filled with a bunch of NULLs) on an improper Windows shutdown, like a BSOD. I had like three of them due to debugging a driver project and the json file got consistently corrupted despite me not using any podman command or changed anything in Podman Desktop during the session.Steps to reproduce the issue
Steps to reproduce the issue
podman-machine-default.json
Describe the results you received
Podman is basically completely dead until it is re-initialized.
Describe the results you expected
I'd like to understand how a file that is not actively written to during the crash can get mangled so badly.
podman info output
Podman in a container
No
Privileged Or Rootless
Privileged
Upstream Latest Release
Yes
The text was updated successfully, but these errors were encountered: