-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
overlay differ: cancel diff calculation cleanly #2662
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.
This looks weird to me. Why isn't the Changes
already returning the correct error? We should not need to handle the cases where err == nil
. If err == nil
that means that there is no error and cw.Close()
should be called (even if context is canceled it was too late). If Changes
returns early because context got canceled then it should always return with an error.
a5ec92a
to
3674f02
Compare
This seems because buildkit/util/overlay/overlay_linux.go Line 207 in a1cfefe
|
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.
Can you point me to where this error is returned that is created because of context is canceled but the error itself does not match canceled error.
cache/blobs_linux.go
Outdated
@@ -40,9 +41,12 @@ func (sr *immutableRef) tryComputeOverlayBlob(ctx context.Context, lower, upper | |||
if err != nil { | |||
return emptyDesc, false, errors.Wrap(err, "failed to open writer") | |||
} | |||
var openErr error // can be set before closing writer. This can be used to make sure the writer is closed. |
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.
cleaner way to do this would be to set cw = nil
after it has been closed and add a nil check if the defer. I'm not sure I understand how this is related to the issue though.
On master version of BuildKit, In the following example of master version BuildKit, code execution doesn't terminate until it encounters FROM registry2-buildkit:5000/ubuntu:20.04-org
RUN head -c 100MB </dev/urandom > /sample # buildctl build --progress=plain --frontend=dockerfile.v0 --local context=/tmp/ctx1 --local dockerfile=/tmp/ctx1 \
--output type=oci,dest=/tmp/out.tar
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile:
#1 transferring dockerfile: 125B done
#1 DONE 0.2s
#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.2s
#3 [internal] load metadata for registry2-buildkit:5000/ubuntu:20.04-org
#3 DONE 0.1s
#4 [auth] sharing credentials for registry2-buildkit:5000
#4 DONE 0.0s
#5 [1/2] FROM registry2-buildkit:5000/ubuntu:20.04-org@sha256:adf73ca014822ad8237623d388cedf4d5346aa72c270c5acc01431cc93e18e2d
#5 resolve registry2-buildkit:5000/ubuntu:20.04-org@sha256:adf73ca014822ad8237623d388cedf4d5346aa72c270c5acc01431cc93e18e2d 0.0s done
#5 sha256:5e9250ddb7d0fa6d13302c7c3e6a0aa40390e42424caed1e5289077ee4054709 187B / 187B 0.0s done
#5 sha256:57671312ef6fdbecf340e5fed0fb0863350cd806c92b1fdd7978adbd02afc5c3 851B / 851B 0.0s done
#5 sha256:345e3491a907bb7c6f1bdddcf4a94284b8b6ddd77eb7d93f09432b17b20f2bbe 28.54MB / 28.54MB 0.1s done
#5 extracting sha256:345e3491a907bb7c6f1bdddcf4a94284b8b6ddd77eb7d93f09432b17b20f2bbe
#5 extracting sha256:345e3491a907bb7c6f1bdddcf4a94284b8b6ddd77eb7d93f09432b17b20f2bbe 0.8s done
#5 extracting sha256:57671312ef6fdbecf340e5fed0fb0863350cd806c92b1fdd7978adbd02afc5c3 0.0s done
#5 extracting sha256:5e9250ddb7d0fa6d13302c7c3e6a0aa40390e42424caed1e5289077ee4054709 0.0s done
#5 DONE 0.0s
#6 [2/2] RUN head -c 100MB </dev/urandom > /sample
#6 DONE 0.9s
#7 exporting to oci image format
#7 exporting layers
C-c C-c
#7 exporting layers 2.5s done
#7 ERROR: missing lease requirement for setBlob
------
> exporting to oci image format:
------
error: failed to solve: Canceled: context canceled |
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
3674f02
to
63c939a
Compare
Fixes #2655
This commit fixes that exporting layers doesn't cancelled cleanly.
master version:
PR version: