Skip to content

Commit

Permalink
Avoid race condition in cleaning up cache files (#45214)
Browse files Browse the repository at this point in the history
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 d4acead)
  • Loading branch information
simonbyrne authored and KristofferC committed May 16, 2022
1 parent e0e24c1 commit 66ba1ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 66ba1ad

Please sign in to comment.