Skip to content

Commit

Permalink
CircleCI caching: allow ftime to be ceil(ftime_req) in Base.stale_cac…
Browse files Browse the repository at this point in the history
…hefile (#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 bf92e83)
  • Loading branch information
nrontsis authored and KristofferC committed Dec 21, 2022
1 parent f0d8e54 commit 079d231
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 079d231

Please sign in to comment.