-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include_dependency
files that are in a different depot from the package are not found during loading
#52161
Comments
Note that the pushfirst!(LOAD_PATH, new_depot)
foofile = joinpath(new_depot, "Foo.jl")
if !isfile(foofile)
cp("Foo.jl", foofile)
end part is not really needed, if one does pushfirst!(LOAD_PATH, ".")
using Foo It still fails to load: julia> using Foo
┌ Debug: Missing @depot tag for include dependencies in cache file /Users/kristoffercarlsson/.julia/compiled/v1.11/Foo.ji.
│ srcfiles = Set(["/Users/kristoffercarlsson/JuliaTests/Foo.jl"])
└ @ Base loading.jl:2727
┌ Debug: Rejecting stale cache file /Users/kristoffercarlsson/.julia/compiled/v1.11/Foo.ji because its depot could not be resolved |
I think you are right that #49866 introduced this regression. IIUC then the issue is here Lines 722 to 731 in 4bc45a7
Assuming this is correct, then the fix is easy. Allowing |
Thinking about it again, I am not sure if making What happens in the above example is this:
In summary, this is just a rephrasing of your earlier comment:
It seems that it is too easy to find the wrong path for |
The initial goal for
To me this is weird — normally, Indeed, I did a search of packages using
(There were a handful of other use cases, e.g. packages loading global |
That surprises me. The
Maybe we should change that? I guess the only question is file's in scratch spaces. |
I have to say I am still not 100% familiar with the precompile code and so I could be wrong too. But IIUC then Lines 48 to 50 in 221f074
Inside that if is where the path is then written.
I remember that initially I did not skip them and this gave me problems. |
You are right. I should not have added 'frequently' to my statement.
|
Putting my confusion aside, I think there are two things actionable
Did I miss something? |
No you didn't, CUDA does indeed do that: https://github.com/JuliaBinaryWrappers/CUDA_Runtime_jll.jl/blob/d7e700c623a51b93ef2421233f1dbc97d8de5904/.pkg/platform_augmentation.jl#L79 |
oh, right, it was in the jll, which doesn't show up in the juliahub search -- puhhh, saved |
I agree that the way
The input files (or at least auxiliary files) could be part of a package which is in a depot. We noticed this not working properly anymore when this custom made module had to precompile every time it was loaded and I found out it was due to the rewriting of the |
One possible way to solve this is to search through all |
I think the central issue here, (from my perspective) is that there is now a requirement that all source files are found within the same depot. We didn't use to have this requirement, and I'm not sure why the requirement exists now. Could we just break that requirement and say that a cache file is loadable if all of the required files can be found in any depot, rather than in a single depot? |
My previous example did not make sense, hence, I deleted it. |
If we start searching at the DEPOT of the package file itself, then there shouldn't be any performance loss in the standard case I think? |
To speak directly to the issue of versioning (which I think your deleted example was about), I think that because we have the package version slugs (and artifact hashes) in the filenames, we are unlikely to run into issues with cross-contamination of files from different versions. |
If the standard case is that pkg and cache are in the same depot, then yes. |
One question, in the first post, the files are stored as:
Where in the code is the absolute path
rewritten into
? To me, we have failed to identify a It feels like there should never be a case where a path gets rewritten into some other absolute path. |
To answer:
The rewriting happens in two steps:
Initially, I also required that the paths looked like
This is fixable by also using the Lines 2761 to 2763 in 72cd63c
This is the fix 1. I suggested above as actionable (sorry, I did not find time yet to open a PR; also I was waiting a bit in case there are more questions that need to be resolved). IIUC then we need a breaking change for
Hence, my suggestion for fix 2. above. |
So what's the path forward here, we have a nonstandard usage of |
If the file after the absolutification of the path does not exist, could we not loop through all |
This would require #51798, because |
Why not switch over to tracking content by default (just like for package files)? |
There are pkgs that rely on |
But if this is restricted to when looking inside a depot it should be ok because you cannot/shouldn't modify something in a depot anyway? |
Depots contain things like |
…erent depots (#52750) Fixes #52161 #52161 is an awkward use of the relocation feature in the sense that it attempts to load the `include()` and `include_dependency` files of a pkg from two separate depots. The problem there is that the value with which we replace the `@depot` tag for both `include()` and `include_dependency()` files is determined by trying to relocate only the `include()` files. We then end up not finding the `include_dependency()` files. Solution: @staticfloat noted that the pkg slugs in depot paths like `@depot/packages/Foo/1a2b3c/src/Foo.jl` are already enough to (weakly) content-address a depot. This means that we should be able to load any `include()` file of a pkg from any `depot` that contains a precompile cache, provided the hashes match. The same logic can be extended to `include_dependency()` files, which this PR does. Note that we continue to use only one file from the `include()` files to determine the depot which we use to relocate all `include()` files. [this behavior is kept from master] But for `include_dependency()` files we allow each file to resolve to a different depot. This way the MWE given in #52161 should be extendable to two README files being located in two different pkgs that lie in two different depots. --- Side note: #49866 started with explicitly verifying that all `include()` files come from the same depot. In #52346 this was already relaxed to pick the first depot for which any `include()` file can be resolved to. This works, because if any other file might be missing from that depot then this is caught in `stalecache()`.
This is a MWE from a regression in an internal package. The end goal in that package is to cache some arbitrary piece of code using Julia's precompile system so that code can be loaded again quickly.
To show the issue, let's create a precompiled module (here in a single file) that we want to be invalidated based on some other file changing. This file could potentially be in a package depot (where it probably won't be changed) but we might also have that dependency file be in a devved package where it could be changed and we then want to recompile the module:
Now, let's say we do not want to pollute our standard depot with cache files from this module (and for some reason we also want to store this module file somewhere else) so we do:
Upon running this we can see the path to the dependency file we injected:
However, when looking what is actually stored in the precompile file, the path to the README file is different:
The README.md file is stored with the location
/var/folders/tp/2p4x9ygx48sgsdl1ccg1mp_40000gn/T/depot/packages/Example/aqsx3/README.md"
which is not the same as what we actually used in theinclude_dependency
call.The issue with that is that when we load this module again, it will not find this file and recompile it:
My guess to what is happening is that after #49866 the precompile system checks all file that are in a depot path and "reifies" them to be the same as that of the package getting loaded. But this fails in cases like this.
It would be good to have some solution to this because this use case is quite useful.
cc @fatteneder
The text was updated successfully, but these errors were encountered: