-
-
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
Conflicting package versions can cause cache files to be rejected #50070
Comments
Will be made more efficient by #49052 at least. I'm not sure whether much can be done if conflicting package versions are present in the parent but not workers |
Is it possible to make the Pkg.precompile do the right thing in the beginning so that the workers don't re-compile extra pkgimages at all? The parent process may be unable to load the new versions, but it seems like the precompile should still work |
Actually that's what it should be doing.. those packages show up as yellow in |
Yeah, I think so - The workaround for now is also pretty awkward: What we're doing is running with |
@IanButterworth I briefly just checked on this to see if there was some issue like the |
I am also surprised why loaded versions would have an affect here. But I can imagine one possible scenario (on Windows) where things would go bad but I am not sure that is applicable here:
Step 3 will try to overwrite the created dll from 1 but that will probably fail since the dll is opened and Windows doesn't let you overwrite open files. However, in this example the packages at different versions are in different environments and should thus be given different paths and be able to coexist peacefully.. |
First, this is reproducible on non-windows, and second, different versions should get different slugs in their cache filename, so I don't think that's the issue. |
Okay, but look at this then:
|
Looks like a smoking gun to me. Before the The slug for the .ji/.so appears to be independent from either package slug: |
I am not sure it is a smoking gun but rather that
is not true and my example in #50070 (comment) is a correctly described problem but is not related to the issue here. |
So the problem is this in assuming that the package is coming from the active project, not one up the stack? Line 2223 in 7f6165e
|
Why would that be a problem in this case here? |
Ok yeah I can't see how. (That does seem wrong though) |
Is it possible this Lines 2264 to 2272 in 631d187
What's its purpose? |
Pkg.precompile disables that https://github.com/JuliaLang/Pkg.jl/blob/edc137f46792d9373ca6d6f91907d55341226a52/src/API.jl#L1481 |
I'm hitting that pathway anyway at Which seems to cause:
|
Yeah, code load precompilation will hit that. AFAICT, distributed doesn't forward |
If you take Distributed out of the picture and start a julia process in the same environment do you see the same issue? |
That's true, but pre-compilation gets triggered unexpectedly in the parent process just as the workers are starting up: using Pkg
Pkg.add(name="Parsers", version="2.5.8");
Pkg.add(name="JSON", version="0.21.3");
Pkg.add(name="Preferences", version="1.3.0");
using Parsers; # Might come from e.g. `startup.jl`
Pkg.activate(; temp=true);
Pkg.add(["PrecompileTools"]);
Pkg.precompile(); # does nothing
using PrecompileTools; # unexpectedly triggers pre-compilation That pre-compilation in the parent process modifies |
Two thoughts for a resolution here:
|
I think the least we should do is the PR here plus my suggestion #44329 (comment) |
That sounds good to me, but we still need to fix the package thrash IMO if we want the Distributed case to work correctly |
Do people use stacked environments in Distributed workers? I can't imagine that's common? |
The use case this issue came from did exactly that - It doesn't seem strange to me that someone would try to |
Another common situation that I just ran into is:
|
We were hitting some issues related to loading Makie from the global environment, while working in a different active project. See:
Your comment there could be possibly related to this @IanButterworth ? |
Create a fresh depot and initialize it with:
Then, try to pre-compile into a temporary environment before
using Distributed
:With
JULIA_DEBUG=loading
we see that we get unexpected pre-compilation in the worker processes:A common real-world situation is having
using PkgAuthentication
in yourstartup.jl
which immediately loads the old, conflicting versions of packages like this before you canPkg.activate(; temp=true)
.It's not obvious to me how much of this behavior is a bug, but at the very least it seems that the precompile/loading system should not repeatedly re-compile the same conflicting package N times across all of the workers.
The text was updated successfully, but these errors were encountered: