Skip to content

Commit

Permalink
Throw precompilation error if dependency load failure during incremen…
Browse files Browse the repository at this point in the history
…tal precompilation

In rare cases, if we fail to load a dependency during precompilation, we can fall-through to the "load locally" fallthrough in `_require()`.  However, if this happens during incremental precompilation, this ends up emitting `.ji` files that have multiple modules embedded within, which can cause massive precompilation issues further down the chain, as dependencies which try to load our `.ji` file themselves get corrupted.

This catches the error at the source, refusing to generate such a `.ji` file in the first place.
  • Loading branch information
staticfloat authored Jun 20, 2023
1 parent a8ef873 commit 9032926
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1919,7 +1919,7 @@ function _require(pkg::PkgId, env=nothing)
else
@warn "The call to compilecache failed to create a usable precompiled cache file for $pkg" exception=m
end
# fall-through to loading the file locally
# fall-through to loading the file locally if not incremental
else
cachefile, ocachefile = cachefile::Tuple{String, Union{Nothing, String}}
m = _tryrequire_from_serialized(pkg, cachefile, ocachefile)
Expand All @@ -1929,6 +1929,10 @@ function _require(pkg::PkgId, env=nothing)
return m
end
end
if JLOptions().incremental != 0
# during incremental precompilation, this should be fail-fast
throw(PrecompilableError())
end
end
end

Expand Down

0 comments on commit 9032926

Please sign in to comment.