From 3be423914d5bb21f4bf12577de4aa56d823e2026 Mon Sep 17 00:00:00 2001 From: Nikitas Rontsis Date: Fri, 4 Nov 2022 09:40:10 +0000 Subject: [PATCH] CircleCI caching: allow ftime to be ceil(ftime_req) in Base.stale_cachefile (#47433) * CircleCI caching: allow ftime to be ceil(ftime_req) in Base.stale_cachefile It appears that [caching functionalities](https://circleci.com/docs/caching/) provided by CircleCi, a leading CI/CD provider, can truncate timestamps to full seconds, resulting in re-compilations as below: ``` Rejecting stale cache file /root/.julia/compiled/v1.8/ComponentArrays/cYHSD_3rQji.ji (mtime 1.6673960929277816e9) because file /root/.julia/packages/ComponentArrays/YyD7i/src/ComponentArrays.jl ``` This PR relaxes the `is_stale` check to be robust against rounding-to-second timestamp mutations. I can provide a minimal CircleCI configuration file to reproduce if this is helpful. (cherry picked from commit bf92e836d3d16876ff48016f55541e4a38ea33ee) --- base/loading.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/base/loading.jl b/base/loading.jl index 4426c2269404df..d69b70a7ad9f7a 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -1797,6 +1797,7 @@ function stale_cachefile(modpath::String, cachefile::String; ignore_loaded = fal ftime = mtime(f) is_stale = ( ftime != ftime_req ) && ( ftime != floor(ftime_req) ) && # Issue #13606, PR #13613: compensate for Docker images rounding mtimes + ( ftime != ceil(ftime_req) ) && # PR: #47433 Compensate for CirceCI's truncating of timestamps in its caching ( ftime != trunc(ftime_req, digits=6) ) && # Issue #20837, PR #20840: compensate for GlusterFS truncating mtimes to microseconds ( ftime != 1.0 ) && # PR #43090: provide compatibility with Nix mtime. !( 0 < (ftime_req - ftime) < 1e-6 ) # PR #45552: Compensate for Windows tar giving mtimes that may be incorrect by up to one microsecond