From 66ba1ad933da3444e2910431259054f214e34c14 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Sat, 7 May 2022 22:02:20 -0700 Subject: [PATCH] Avoid race condition in cleaning up cache files (#45214) If multiple processes attempt to clean up cache files at the same time, a race condition can result, e.g. https://buildkite.com/clima/climaatmos-ci/builds/812#6a961e99-e2a1-488b-a116-2a45dee26d38/102-104 (cherry picked from commit d4acead9130f97f0135bee604d94e1f67dabc70f) --- base/loading.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/loading.jl b/base/loading.jl index 9a8a0b50e2166..c1ddabda6c469 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -1541,7 +1541,7 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in cachefiles = filter!(x -> startswith(x, entryfile * "_"), readdir(cachepath)) if length(cachefiles) >= MAX_NUM_PRECOMPILE_FILES[] idx = findmin(mtime.(joinpath.(cachepath, cachefiles)))[2] - rm(joinpath(cachepath, cachefiles[idx])) + rm(joinpath(cachepath, cachefiles[idx]); force=true) end end