Skip to content

Consider including architecture in cache keys #1008

Closed

Description

@silverwind

Description:
The cache keys are currently node-cache-Linux-npm-<hash> which does not seem to include the CPU architecture so if npm dependencies include native binaries and the same cache is restored on a different architecture than what it was built on, these binaries would fail to run.

Action version:
4

Platform:
All

Runner type:
All

Tools version:
All

Repro steps:

  • Build a cache on a x86 runner
  • Restore cache on a ARM runner

Expected behavior:
Cache key should include architecture

Actual behavior:
Cache key does not include architecture

Activity

  1. changed the title [-]Consider including `architecture` in cache file name[/-] [+]Consider including `architecture` in cache keys[/+] on Apr 19, 2024
  2. v-HarithaVattikuti commented on Apr 19, 2024

    @v-HarithaVattikuti
    Contributor

    Hello @silverwind
    Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

  3. silverwind commented on Apr 24, 2024

    @silverwind
    Author

    Yes, different node major version have different ABI versions, so I would recommend including node major version in the cache key. Minor/patch versions should be strictly ABI compatible. Also see https://nodejs.org/en/learn/modules/abi-stability.

  4. rlmcneary2 commented on May 21, 2024

    @rlmcneary2

    Pretty sure this would resolve a problem with rollup where it uses a binary for a specific architecture. The binary for the first build is cached and then there are failures on subsequent builds if the cached arch. doesn't match the current arch. The workaround is to add the different architecture packages as optional dependencies.

    Error: Cannot find module @rollup/rollup-linux-x64-gnu

  5. v-gowridurgad commented on Jun 13, 2024

    @v-gowridurgad
    Contributor

    Hi @silverwind, Thanks for your valuable suggestion. After analyzing the issue, It seems to be more of a potential feature request rather than a bug. The idea of incorporating the architecture in cache keys could be a significant step in managing npm dependencies with native binaries on various architectures. We've taken your suggestion into consideration for possible future enhancements .

  6. removed their assignment
    on Jun 13, 2024
  7. silverwind commented on Jun 13, 2024

    @silverwind
    Author
  8. added
    feature requestNew feature or request to improve the current logic
    and removed
    bugSomething isn't working
    on Jun 17, 2024
  9. clintonb commented on Dec 14, 2024

    @clintonb

    This was fixed by #843 a couple months ago.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions