Skip to content

Commit

Permalink
Clear CCache directory on possible corruption
Browse files Browse the repository at this point in the history
CCache might segfault on e.g. MacOS which can be resolved by clearing
the cache.
This might be done by deleting the GitHub Actions cache but as there is
one for each build it might become cumbersome.
So delete the folder inside the setup script when `ccache -z`
(simplest command that triggered the segfault) fails.
  • Loading branch information
Flamefire committed Dec 27, 2024
1 parent b85cc78 commit 88e79a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions ci/common_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ if [ "$B2_USE_CCACHE" == "1" ]; then
echo
echo
B2_USE_CCACHE=0
print_on_gha "::error title=CCache::CCache disabled due to an error!"
set -x
fi
fi
Expand Down
6 changes: 6 additions & 0 deletions ci/setup_ccache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ ccache --version
# This also sets the default values
echo "Using cache directory of size ${B2_CCACHE_SIZE:=500M} at '${B2_CCACHE_DIR:=$HOME/.ccache}'"

if ! ccache -z &> /dev/null; then
print_on_gha "::warning title=CCache::Possible cache corruption detected!"
# Might happen if the cache got corrupted
echo "Clearing possibly corrupted CCache directory"
rm -rf "$B2_CCACHE_DIR" "$HOME/.ccache"
fi

ccache --set-config=cache_dir="$B2_CCACHE_DIR"
ccache --set-config=max_size="$B2_CCACHE_SIZE"
Expand Down

0 comments on commit 88e79a6

Please sign in to comment.