Skip to content
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

Pkg.precompile sometimes doesn't avoid precompilation during load time #2361

Closed
IanButterworth opened this issue Jan 24, 2021 · 0 comments · Fixed by #2373
Closed

Pkg.precompile sometimes doesn't avoid precompilation during load time #2361

IanButterworth opened this issue Jan 24, 2021 · 0 comments · Fixed by #2373

Comments

@IanButterworth
Copy link
Member

There is an edge case in Pkg's precompilation for which we currently don't have a fix. I'm making this issue to make it easier to track given it has been discussed in a few places

One might see

(jl_dDFSry) pkg> precompile

julia> @time (using Plots; display(plot(1:0.1:10, sin.(1:0.1:10))))
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]

This has improved since julia 1.5 (#1578), but is still known to happen as a result of this kind of sequence:

pkg> add Plots, GR
... # add and fully precompile packages

julia> using Plots

pkg> pin [email protected] # roll back GR
... # precomp will ? for Plots given it's loaded

restart julia

pkg> precompile

julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]

The problem is that Base.stale_cachefile can only check whether dependencies of a module have been updated if they are loaded in Main.
Pkg.precompile works around this, given the modules aren't actually loaded into Main, by keeping track itself of whether dependencies are updated.
But if Pkg.precompile isn't able to precompile a package due to it being loaded in Main, and julia is restarted, the new precompile attempt has no idea that dependencies have been recompiled.

In writing this up it occurs to me that the fix could be to add a force_precomp list of packages that's saved to the scratch space, to remember packages that still need precomp (i.e. packages with ?), like the way pkgs_precompile_suspended works.

Previous discussion around this:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant