-
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
http: Handle missing but unambiguous ETags in response #1159
Conversation
Please sign your commits following these rules: $ git clone -b "fix-etag" git@github.com:erydo/buildkit.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f Amending updates the existing PR. You DO NOT need to open a new one. |
If a single ETag is requested in `If-None-Match`, some servers do not include that (unambiguous) ETag header in the response. For detailed description, see: moby#905 (comment) Signed-off-by: Robert Estelle <robertestelle@gmail.com>
Otherwise a 200 response without an ETag could be incorrectly associated to previous content in the following scenario: * The remote server had in the past responded with an ETag for this resource, which was cached. - (Otherwise, onlyETag would be empty) * That was the only ETag cached for this resource. - (Otherwise, onlyETag would be empty) * The remote server then stopped supporting ETag/If-None-Match for this resource at all. - (Otherwise, it would respond with a 304 or a 200+ETag) Signed-off-by: Robert Estelle <robertestelle@gmail.com>
This comment has been minimized.
This comment has been minimized.
full diff: moby/buildkit@f704282...ae10b29 fixes: - moby/buildkit#1144 Fix socket handling - fsutil: Handle copying unix sockets in local sources - update github.com/containerd/continuity to 75bee3e2ccb6 - update github.com/tonistiigi/fsutil to 3d2716dd0a4d - moby/buildkit#1150 ssh: Fix file descriptor leak when doing SSH forwarding - fixes moby/buildkit#1146 SSH Forwarding Doesn't Release File Descriptors - moby/buildkit#1156 llbsolver: Fix using multiple remote cache importers - moby/buildkit#1159 http: Handle missing but unambiguous ETags in response - fixes moby/buildkit#905 ADD from url fails with 'invalid not-modified ETag' - fixes moby/buildkit#784 invalid not-modified ETag with local network ADD in docker - moby/buildkit#1166 solver: Fix possible inefficient parallelization in solver - fix cases where some events were dropped resulting inefficient parallelization. - moby/buildkit#1168 vendor: update go-runc to e029b79d - moby/buildkit#1140 contenthash: Fix bug with symlink in source path of a copy operation - fixes moby/buildkit#974 COPY --from fails when source path involves a symlink - fixes moby/buildkit#785 COPY rpc error: code = Unknown desc = not found: not found - fixes moby/buildkit#958 Issue COPY a file to a symlink directory - moby/buildkit#1139 executor: oom_score_adj is no longer set from main process Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Stupid question? Why is this bug still in "Docker for Mac" which is using a much later version of Buildkit? Docker Desktop (Mac)
Build fails when ADD tries to check Github repository commit with "failed to load cache key: invalid not-modified ETag" What can I do to help resolve the issue? |
@BrendonW could you open a new ticket with an example to reproduce the issue? |
Fixes #905 and #784.
If a single ETag is requested in
If-None-Match
, some servers do not include that (unambiguous) ETag header in the response.This has not been tested. I'm developing on a Mac and not able to devote much more time to this bug, but figured it was worth at least a beginner shot at fixing it.
Detailed description from #905 (comment) partially reproduced below:
Reproduction Steps
Dockerfile
The first run (or a run after the cache is cleared) succeeds:
DOCKER_BUILDKIT=1 docker build .
Running the same command again:
Clearing the cache with
docker builder prune
resets the state.Cause
If a single ETag is requested in
If-None-Match
, the server may not include that (unambiguous) ETag header in the response.Detailed demonstration
Requesting the file directly:
Response headers. Notice the ETag.
Requesting the file
If-None-Match
with that ETag:curl --http1.1 -s -L -D /dev/stderr -o /dev/null -H 'If-None-Match: "ca0368fcd3c4c1a99aca42511d0c1f12"' https://storage.googleapis.com/gpt-2/models/774M/checkpoint
Notice that the ETag is not included in the response headers.
Requesting the file with multiple ETags in
If-None-Match
:curl --http1.1 -s -L -D /dev/stderr -o /dev/null -H 'If-None-Match: "ca0368fcd3c4c1a99aca42511d0c1f12", "foobar"' https://storage.googleapis.com/gpt-2/models/774M/checkpoint
Now the ETag is included to disambiguate.