https://github.com/JuliaLang/julia
Revision 9e8fe688c5e32bde3ab48bb71f9d4ab45ef272ee authored by Valentin Churavy on 24 November 2023, 22:35:51 UTC, committed by GitHub on 24 November 2023, 22:35:51 UTC
Fixes #52213 Overwritting methods during cache creation is currently not something that the system can support and can lead to surprising, counter-intuitive and fatal errors. In 1.10 we turned it from a warning to a strong error, with this PR it remains a strong error, but the precompilation system recognizes it and essentially sets `__precompile__(false)` for this module and all modules that depend on it. Before: ``` julia> using OverwriteMethodError [ Info: Precompiling OverwriteMethodError [top-level] WARNING: Method definition +(Bool, Bool) in module Base at bool.jl:166 overwritten in module OverwriteMethodError at /home/vchuravy/src/julia2/OverwriteMethodError.jl:2. ERROR: LoadError: Method overwriting is not permitted during Module precompile. Stacktrace: [1] top-level scope @ ~/src/julia2/OverwriteMethodError.jl:2 [2] include @ Base ./Base.jl:489 [inlined] [3] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing) @ Base ./loading.jl:2216 [4] top-level scope @ stdin:3 in expression starting at /home/vchuravy/src/julia2/OverwriteMethodError.jl:1 in expression starting at stdin:3 ERROR: Failed to precompile OverwriteMethodError [top-level] to "/home/vchuravy/.julia/compiled/v1.10/jl_guiuCQ". Stacktrace: [1] error(s::String) @ Base ./error.jl:35 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool) @ Base ./loading.jl:2462 [3] compilecache @ Base ./loading.jl:2334 [inlined] [4] (::Base.var"#968#969"{Base.PkgId})() @ Base ./loading.jl:1968 [5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool}) @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:93 [6] #mkpidlock#6 @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:88 [inlined] [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64}) @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:111 [8] #invokelatest#2 @ Base ./essentials.jl:889 [inlined] [9] invokelatest @ Base ./essentials.jl:884 [inlined] [10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64) @ Base ./loading.jl:2977 [11] maybe_cachefile_lock @ Base ./loading.jl:2974 [inlined] [12] _require(pkg::Base.PkgId, env::String) @ Base ./loading.jl:1964 [13] __require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1806 [14] #invoke_in_world#3 @ Base ./essentials.jl:921 [inlined] [15] invoke_in_world @ Base ./essentials.jl:918 [inlined] [16] _require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1797 [17] macro expansion @ Base ./loading.jl:1784 [inlined] [18] macro expansion @ Base ./lock.jl:267 [inlined] [19] __require(into::Module, mod::Symbol) @ Base ./loading.jl:1747 [20] #invoke_in_world#3 @ Base ./essentials.jl:921 [inlined] [21] invoke_in_world @ Base ./essentials.jl:918 [inlined] [22] require(into::Module, mod::Symbol) @ Base ./loading.jl:1740 ``` After: ``` julia> using OverwriteMethodError ┌ Info: Precompiling OverwriteMethodError [top-level] └ @ Base loading.jl:2486 WARNING: Method definition +(Bool, Bool) in module Base at bool.jl:166 overwritten in module OverwriteMethodError at /home/vchuravy/src/julia2/OverwriteMethodError.jl:2. ERROR: Method overwriting is not permitted during Module precompile. ┌ Info: Skipping precompilation since __precompile__(false). Importing OverwriteMethodError [top-level]. └ @ Base loading.jl:2084 ``` --------- Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com>
1 parent 6e23543
Tip revision: 9e8fe688c5e32bde3ab48bb71f9d4ab45ef272ee authored by Valentin Churavy on 24 November 2023, 22:35:51 UTC
Turn Method Overwritten Error into a PrecompileError -- turning off caching (#52214)
Turn Method Overwritten Error into a PrecompileError -- turning off caching (#52214)
Tip revision: 9e8fe68
File | Mode | Size |
---|---|---|
RelocationTestPkg1 | ||
RelocationTestPkg2 | ||
TestPkg | ||
clangsa | ||
compiler | ||
depot | ||
embedding | ||
gc | ||
gcext | ||
llvmpasses | ||
manifest | ||
netload | ||
project | ||
strings | ||
testhelpers | ||
unicode | ||
.gitignore | -rw-r--r-- | 94 bytes |
Makefile | -rw-r--r-- | 3.1 KB |
abstractarray.jl | -rw-r--r-- | 73.2 KB |
ambiguous.jl | -rw-r--r-- | 16.6 KB |
arrayops.jl | -rw-r--r-- | 106.8 KB |
asyncmap.jl | -rw-r--r-- | 2.4 KB |
atexit.jl | -rw-r--r-- | 10.5 KB |
atomics.jl | -rw-r--r-- | 22.9 KB |
backtrace.jl | -rw-r--r-- | 9.1 KB |
binaryplatforms.jl | -rw-r--r-- | 21.0 KB |
bitarray.jl | -rw-r--r-- | 70.6 KB |
bitset.jl | -rw-r--r-- | 10.7 KB |
boundscheck.jl | -rw-r--r-- | 814 bytes |
boundscheck_exec.jl | -rw-r--r-- | 7.2 KB |
broadcast.jl | -rw-r--r-- | 42.7 KB |
cartesian.jl | -rw-r--r-- | 19.5 KB |
ccall.jl | -rw-r--r-- | 64.3 KB |
channel_threadpool.jl | -rw-r--r-- | 613 bytes |
channels.jl | -rw-r--r-- | 18.2 KB |
char.jl | -rw-r--r-- | 11.2 KB |
checked.jl | -rw-r--r-- | 16.9 KB |
choosetests.jl | -rw-r--r-- | 9.9 KB |
client.jl | -rw-r--r-- | 1.6 KB |
cmdlineargs.jl | -rw-r--r-- | 43.6 KB |
combinatorics.jl | -rw-r--r-- | 5.0 KB |
complex.jl | -rw-r--r-- | 55.0 KB |
copy.jl | -rw-r--r-- | 7.5 KB |
core.jl | -rw-r--r-- | 209.4 KB |
corelogging.jl | -rw-r--r-- | 15.3 KB |
deprecation_exec.jl | -rw-r--r-- | 6.2 KB |
dict.jl | -rw-r--r-- | 47.9 KB |
docs.jl | -rw-r--r-- | 32.4 KB |
download.jl | -rw-r--r-- | 262 bytes |
download_exec.jl | -rw-r--r-- | 1.0 KB |
enums.jl | -rw-r--r-- | 7.9 KB |
env.jl | -rw-r--r-- | 5.0 KB |
error.jl | -rw-r--r-- | 3.8 KB |
errorshow.jl | -rw-r--r-- | 41.1 KB |
euler.jl | -rw-r--r-- | 16.9 KB |
exceptions.jl | -rw-r--r-- | 10.8 KB |
fastmath.jl | -rw-r--r-- | 10.6 KB |
file.jl | -rw-r--r-- | 61.2 KB |
filesystem.jl | -rw-r--r-- | 1.2 KB |
float16.jl | -rw-r--r-- | 7.5 KB |
floatapprox.jl | -rw-r--r-- | 2.3 KB |
floatfuncs.jl | -rw-r--r-- | 10.5 KB |
functional.jl | -rw-r--r-- | 7.6 KB |
gc.jl | -rw-r--r-- | 981 bytes |
generic_map_tests.jl | -rw-r--r-- | 4.0 KB |
gmp.jl | -rw-r--r-- | 23.5 KB |
goto.jl | -rw-r--r-- | 3.1 KB |
hashing.jl | -rw-r--r-- | 10.1 KB |
int.jl | -rw-r--r-- | 15.5 KB |
interpreter.jl | -rw-r--r-- | 919 bytes |
intfuncs.jl | -rw-r--r-- | 23.1 KB |
intrinsics.jl | -rw-r--r-- | 18.9 KB |
iobuffer.jl | -rw-r--r-- | 10.4 KB |
iostream.jl | -rw-r--r-- | 5.6 KB |
iterators.jl | -rw-r--r-- | 35.1 KB |
keywordargs.jl | -rw-r--r-- | 11.3 KB |
llvmcall.jl | -rw-r--r-- | 8.8 KB |
llvmcall2.jl | -rw-r--r-- | 3.7 KB |
loading.jl | -rw-r--r-- | 47.9 KB |
math.jl | -rw-r--r-- | 62.0 KB |
meta.jl | -rw-r--r-- | 8.1 KB |
misc.jl | -rw-r--r-- | 42.3 KB |
missing.jl | -rw-r--r-- | 25.1 KB |
mod2pi.jl | -rw-r--r-- | 12.8 KB |
mpfr.jl | -rw-r--r-- | 35.9 KB |
namedtuple.jl | -rw-r--r-- | 16.9 KB |
numbers.jl | -rw-r--r-- | 117.5 KB |
offsetarray.jl | -rw-r--r-- | 29.9 KB |
opaque_closure.jl | -rw-r--r-- | 10.7 KB |
operators.jl | -rw-r--r-- | 11.7 KB |
ordering.jl | -rw-r--r-- | 2.4 KB |
osutils.jl | -rw-r--r-- | 2.6 KB |
parse.jl | -rw-r--r-- | 13.0 KB |
path.jl | -rw-r--r-- | 17.4 KB |
precompile.jl | -rw-r--r-- | 66.7 KB |
print_process_affinity.jl | -rw-r--r-- | 896 bytes |
profile_spawnmany_exec.jl | -rw-r--r-- | 300 bytes |
ranges.jl | -rw-r--r-- | 98.3 KB |
rational.jl | -rw-r--r-- | 31.8 KB |
read.jl | -rw-r--r-- | 23.8 KB |
reduce.jl | -rw-r--r-- | 26.3 KB |
reducedim.jl | -rw-r--r-- | 31.0 KB |
reflection.jl | -rw-r--r-- | 40.2 KB |
regex.jl | -rw-r--r-- | 12.0 KB |
reinterpretarray.jl | -rw-r--r-- | 23.7 KB |
relocatedepot.jl | -rw-r--r-- | 5.1 KB |
rounding.jl | -rw-r--r-- | 17.0 KB |
runtests.jl | -rw-r--r-- | 17.8 KB |
ryu.jl | -rw-r--r-- | 39.2 KB |
scopedvalues.jl | -rw-r--r-- | 2.9 KB |
secretbuffer.jl | -rw-r--r-- | 5.2 KB |
sets.jl | -rw-r--r-- | 33.8 KB |
show.jl | -rw-r--r-- | 99.3 KB |
simdloop.jl | -rw-r--r-- | 4.5 KB |
smallarrayshrink.jl | -rw-r--r-- | 626 bytes |
some.jl | -rw-r--r-- | 4.3 KB |
sorting.jl | -rw-r--r-- | 46.7 KB |
spawn.jl | -rw-r--r-- | 35.5 KB |
specificity.jl | -rw-r--r-- | 12.7 KB |
stack_overflow.jl | -rw-r--r-- | 1.0 KB |
stacktraces.jl | -rw-r--r-- | 9.5 KB |
staged.jl | -rw-r--r-- | 10.1 KB |
stress.jl | -rw-r--r-- | 2.6 KB |
stress_fd_exec.jl | -rw-r--r-- | 675 bytes |
subarray.jl | -rw-r--r-- | 26.6 KB |
subtype.jl | -rw-r--r-- | 112.5 KB |
syntax.jl | -rw-r--r-- | 108.6 KB |
sysinfo.jl | -rw-r--r-- | 1.6 KB |
terminfo.jl | -rw-r--r-- | 43.9 KB |
test_exec.jl | -rw-r--r-- | 157 bytes |
test_sourcepath.jl | -rw-r--r-- | 601 bytes |
testdefs.jl | -rw-r--r-- | 4.4 KB |
testenv.jl | -rw-r--r-- | 2.5 KB |
threadpool_latency.jl | -rw-r--r-- | 1.2 KB |
threadpool_use.jl | -rw-r--r-- | 755 bytes |
threads.jl | -rw-r--r-- | 10.6 KB |
threads_exec.jl | -rw-r--r-- | 32.7 KB |
triplequote.jl | -rw-r--r-- | 1.3 KB |
tuple.jl | -rw-r--r-- | 28.7 KB |
vecelement.jl | -rw-r--r-- | 3.4 KB |
version.jl | -rw-r--r-- | 8.9 KB |
worlds.jl | -rw-r--r-- | 15.7 KB |
Computing file changes ...