You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When starting multiple vms in parallel using the same uncached yet
image, we downloaded the data to the same temporary file (data.tmp) and
wrote metadata to the same files (url, time, type, {digest}.digest). We
could fail in many ways:
- One process removes the cache directory when another tries to rename a
temporary file to the destination file.
- One process fails to remove the cache directory since another process
started to download and the directory is not empty.
- Corrupting data when writing to the same file from multiple processes.
Mostly likely when writing downloaded data.
Fixes:
- Do not remove the cache directory before the download. This avoids the
failing to remove non-empty directory, and failure to rename a
temporary file.
- Write all data to temporary files, replacing the destination file when
the write is complete. This avoid corrupted data.
- Do not remove destination file when creating a new temporary file or
renaming since creating a file truncate existing file and renaming
replace it.
Issues:
- On windows os.Rename is not atomic, but it should work when using
NTFS.
- On failures we may have lefover temporary files ({name}.tmp.{pid}).
Fixes#2722
Signed-off-by: Nir Soffer <[email protected]>
0 commit comments