Skip to content

Debugging common CI failures

Kendal Harland edited this page Jul 26, 2024 · 5 revisions

Error: sccache 'Error removing file from cache'

The GitHub action at hendrikmuhs/ccache-action includes a post-step that creates a GitHub cache using our supplied key pattern: ${{ matrix.os }}-${{ matrix.arch }}-<suffix>. Sometimes the cache can become corrupted [1] which generates an error message like this:

sccache: encountered fatal error
sccache: error: thread 'tokio-runtime-worker' panicked at src\lru_disk_cache\mod.rs:204:17: Error removing file from cache: `"C:\\a\\swift-build\\swift-build/.sccache\\preprocessor\\8\\f\\2\\8f2e7d1b9af7ff2cc23c6829fc3cae3044c631d88bf597901be5e04795779aad"`: failed to remove file `C:\a\swift-build\swift-build/.sccache\preprocessor\8\f\2\8f2e7d1b9af7ff2cc23c6829fc3cae3044c631d88bf597901be5e04795779aad`
sccache: caused by: thread 'tokio-runtime-worker' panicked at src\lru_disk_cache\mod.rs:204:17: Error removing file from cache: `"C:\\a\\swift-build\\swift-build/.sccache\\preprocessor\\8\\f\\2\\8f2e7d1b9af7ff2cc23c6829fc3cae3044c631d88bf597901be5e04795779aad"`: failed to remove file `C:\a\swift-build\swift-build/.sccache\preprocessor\8\f\2\8f2e7d1b9af7ff2cc23c6829fc3cae3044c631d88bf597901be5e04795779aad`

To fix this, delete the corrupted caches from GitHub. This can be done from the caches page or the command line using gh. Here's an example of deleting caches related to Android ICU build steps in Powershell:

gh cache list -k sccache-Android- --limit 100 --json key --jq '.[] | .key' | `
    Select-String -Pattern "-icu" | `
    %{ gh cache delete $_ }

We sometimes notice that the cache corruption returns when building for Android. It is often the case that the cache is simply not large enough. To fix this, simply increase the maximum cache size on the corresponding compnerd/sccache-action invocation:

 - name: Setup sccache
   uses: compnerd/[email protected]
     with:
       max-size: 150M
       ...
Clone this wiki locally