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
[WIP]Delete corrupt exist lower layer when pull image #42978
base: master
Are you sure you want to change the base?
Conversation
Related ISSUE #35747 |
1157ad9
to
7f77f97
Compare
@thaJeztah PTAL |
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.
As a preventative I would recommend changing overlay's create
method to setup the dir in a staging area and then move into place once complete.
Then we can cleanup those staging areas on startup if there is stuff left over.
@@ -398,10 +398,24 @@ func (ls *layerStore) Get(l ChainID) (Layer, error) { | |||
if layer == nil { | |||
return nil, ErrLayerDoesNotExist | |||
} | |||
if !ls.driver.Exists(layer.cacheID) { | |||
if err := ls.deleteCorruptLayer(layer); err != nil { |
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.
Even though the layer itself is corrupt, deleting it at this level doesn't really seem right.
For drivers like btrfs this especially wouldn't work (granted it seems like it would be weirder to get into this situation with btrfs).
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.
It seems like if we want to recover from this we need a way to repair the layer, but this seems non-trivial from a more generic standpoint.
fa073f7
to
87bb081
Compare
9b269f2
to
acbac61
Compare
ae9540d
to
87a2fbb
Compare
If lower layers corrupt with disk full, host or daemon crash or other reasons, may let the layer link and lower file empty in the disk, which can lead new image pull also get an invalid lower file, typically image lower file's content ends with an colon. Despit the image pull success, but can not inspect with error message "Error response from daemon: readlink /var/lib/docker/overlay2/l: invalid argument". So, when pull image check exist layer, can add layer valid check logic. If cause a corrupt layer, delete and pull register it again. Signed-off-by: Jeff Zvier <zvier20@gmail.com>
87a2fbb
to
f2d4cbb
Compare
Hi, |
If layer corrupt with disk full, host or daemon crash or some other reasons,
may let the layer link and lower file empty in the disk, which can lead new
image pull also get lower file with invalid content, typically image lower file's
content ends with an colon character. Despit the image pull success, but can not inspect
with error message "Error response from daemon: readlink /var/lib/docker/overlay2/l: invalid argument".
So, when pull image check exist layer, can add layer valid check logic. If
cause a corrupt layer, delete it and pull it again.
Signed-off-by: Jeff Zvier zvier20@gmail.com