Understanding "rejecting cache file …"

Hi, I have a package that I develop locally and which has a few dependencies, and I don’t understand why I get so many debug messages “rejecting cache file …” when loading it (which, I guess, also increases the loading time). I precise that this happens even when I do not modify anything. E.g.: I load julia, I load my module with “using MyModule” in the REPL, I exit the REPL, I re-enter the REPL, I re-run “using MyModule”… and plenty of such messages. Is basically see 3 types of such messages:

  1. ┌ Debug: Rejecting cache file […].ji because it is for file […]SomePackage/SomeHash/src/[…]) not file […]SomePackage/SomeOtherHash/src/[…] └ @ Base loading.jl:1480
  2. ┌ Debug: Rejecting cache file […] because module […] is already loaded and incompatible. └ @ Base loading.jl:1448
  3. ┌ Debug: Rejecting cache file […].ji because dependency […] not found. └ @ Base loading.jl:1454

Could someone explain me what is likely to trigger such messages? I’m not sure to really understand what it means. I understand that in a “normal” workflow, loading other packages before/after can invalidate some cached files, but here I don’t get it. I tried to stay in the basic environment for simplicity, and not to load anything else. I usually have in my startup file “using Statistics, LinearAlgebra, Revise”, but I even tried to remove that and it does not seems to change anything. (And I’m using julia 1.5.3)

1 Like

You could first try to clean out .julia/v1.5/compiled. Second, are you doing a bunch of manipulations with JULIA_LOAD_PATH in your code?

1 Like

I’m not manipulating JULIA_LOAD_PATH at all, but indeed after cleaning all the files in .julia/v1.5 it seems that I don’t have problems anymore. Is it expected that we might have to do this manually from time to time? Is there still a reason why recompiling one time is not sufficient in this setting? Thanks!

1 Like

Not really expected, but I’ve noticed that it seems to help for some reason…

I’d really like to understand more about this: Repeated Pkg precompilation and loading precompilation for the same package version · Issue #2761 · JuliaLang/Pkg.jl · GitHub seems like a very similar issue.

I feel like I must be doing something wrong because I hit this pretty much any time I do using, even after ]precompile.

I do not know why my precompile caches are getting invalidated and/or rejected. What should I do to further investigate how this happens? Is it Revise? It seems to happen even if I disable startup. Often it seems like its Parser

I just deleted my compiled folder and somehow I’ve already caused Pkg to get invalidated.