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
Currently it is not possible to write images with overlapping layers concurrently. The reason it is not possible is because two layers could write to the same file at the same time. This would result in data being overwritten and the incorrect written byte count returned.
Running this code results in the following errors.
write error error writing layer: expected blob size 2622396, but only wrote 23
write error error writing layer: expected blob size 307023, but only wrote 23
write error error writing layer: expected blob size 307023, but only wrote 23
write error error writing layer: expected blob size 307023, but only wrote 23
write error error writing layer: expected blob size 2622396, but only wrote 45
write error error writing layer: expected blob size 2622395, but only wrote 23
write error error writing layer: expected blob size 307023, but only wrote 23
write error error writing layer: expected blob size 2622399, but only wrote 23
write error error writing layer: expected blob size 2622396, but only wrote 23
Expected behavior
Images with overlapping layers should successfully write when done concurrently.
Additional context
My suggestion to solve this issue is to introduce file locks to the write blob logic to make sure that a single file could only be written by one thread. This would solve the issue for concurrently writing multiple images with overlapping files and also images with duplicate layers. This could in theory solve the issues described in #1920.
The text was updated successfully, but these errors were encountered:
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Keep fresh with the 'lifecycle/frozen' label.
Describe the bug
Currently it is not possible to write images with overlapping layers concurrently. The reason it is not possible is because two layers could write to the same file at the same time. This would result in data being overwritten and the incorrect written byte count returned.
go-containerregistry/pkg/v1/layout/write.go
Lines 235 to 239 in ff385a9
To Reproduce
The simplest way to reproduce this issue is to attempt to write the same image twice concurrently.
Running this code results in the following errors.
Expected behavior
Images with overlapping layers should successfully write when done concurrently.
Additional context
My suggestion to solve this issue is to introduce file locks to the write blob logic to make sure that a single file could only be written by one thread. This would solve the issue for concurrently writing multiple images with overlapping files and also images with duplicate layers. This could in theory solve the issues described in #1920.
The text was updated successfully, but these errors were encountered: