Skip to content

Broken BuildKit deduplication when using cache mounts #495

Closed

Description

@aluzzardi

We've had a regression since BuildKit 0.8.3: when using cache mounts, pipelines get executed multiple times (each time they're referenced).

This is because we use the cue value path as "cache key".

#414 implemented a workaround: if the value is a reference, use the reference as the "cache key" rather than the value itself (see https://github.com/dagger/dagger/pull/414/files#diff-12b33ae88bbb59b957748ffced0d12a6a6248013fc81d342fdc44343ce2c692cR441 canonicalPath())

However, the fix is not recursive so we have the same problem when using references of references.

We fixed the issue in AWS by removing cache mounts (#481), however all other packages using cache mounts are still broken.

Suggested resolution:

  • Implement a proper fix for cache mounts to that take into account reference of references. !!! NOTE: I tried to recursively resolve the reference but I run into issues. Unfortunately I don't remember exactly what the issue was, but I think I ended up with multiple pipelines sharing the same cache (e.g. foo: go.#Build and bar: go.#Build sharing the same cache because they're both references to go, which is wrong, they shouldn't share the cache).
  • If we can't find a quick solution for that, instead of removing the mount in the cue config like we did for s3 (which hides the problem until next time), perhaps we should disable cache mounts in dagger itself (e.g. replace with a mkdir in LLB). At least it fixes the problem for ALL configs without requiring any Cue changes, and we can re-enable them at once when we have a fix

Activity

  1. added
    kind/bug
    on May 25, 2021
  2. added this to the beta milestone on May 25, 2021
  3. shykes commented on May 28, 2021

    @shykes
    Contributor

    +1 on disabling cache mounts for now, and continuing to look for a long term fix.

  4. samalba commented on May 29, 2021

    @samalba
    Contributor

    +2

  5. self-assigned this
    on Jun 7, 2021
  6. modified the milestones: v0.1.0, on Jun 8, 2021
  7. modified the milestones: , v0.1.0 on Jun 14, 2021
  8. samalba commented on Jun 14, 2021

    @samalba
    Contributor

    Implemented workaround: #594 so the long term fix can wait a little more.

  9. modified the milestones: v0.1.0, , , next on Jan 4, 2022
  10. aluzzardi commented on Jan 7, 2022

    @aluzzardi
    ContributorAuthor

    @grouville Could you please verify this works with Europa?

  11. modified the milestones: v0.2.0-alpha.3, next on Jan 31, 2022
  12. grouville commented on Feb 12, 2022

    @grouville
    Member

    Ok, tested with high level api (yarn.#Build, docker.#Run and engine API). example: https://gist.github.com/grouville/38ab3d239a492076ce6efdc14e3df95d

    No deduplication found, LGTM to me. Closing this @aluzzardi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions