JuliaLang / Downloads.jl

MIT License
89 stars 35 forks source link

Crashes when loading package after using Downloads.download during precompilation of package #224

Open KristofferC opened 1 year ago

KristofferC commented 1 year ago

Inserting a small

Downloads.download("file://" * @__FILE__)

at the end of the package to precompile a bit causes a crash:

julia> using Downloads
[ Info: Precompiling Downloads [f43b241f-c20a-4ad4-852c-f6b1247861c6]
Task
Task(next=nothing, queue=Base.IntrusiveLinkedList{Task}(head=<circular reference @-2>, tail=<circular reference @-2>), storage=nothing, donenotify=Base.GenericCondition{Base.Threads.SpinLock}(waitq=Base.IntrusiveLinkedList{Task}(head=nothing, tail=nothing), lock=Base.Threads.SpinLock(owned=0)), result=nothing, logstate=nothing, code=Base.var"#702#703"{Downloads.Curl.var"#31#35"{Downloads.Curl.Multi}, Base.Timer}(cb=Downloads.Curl.var"#31#35"{Downloads.Curl.Multi}(multi=Downloads.Curl.Multi(lock=Base.ReentrantLock(locked_by=nothing, reentrancy_cnt=0x00000000, havelock=0x00, cond_wait=Base.GenericCondition{Base.Threads.SpinLock}(waitq=Base.IntrusiveLinkedList{Task}(head=nothing, tail=nothing), lock=Base.Threads.SpinLock(owned=0)), _=(0, 0, 0)), handle=0x0000000124e5a000, timer=Base.Timer(handle=0x0000000105e327c0, cond=Base.GenericCondition{Base.Threads.SpinLock}(waitq=Base.IntrusiveLinkedList{Task}(head=<circular reference @-5>, tail=<circular reference @-5>), lock=Base.Threads.SpinLock(owned=0)), isopen=true, set=false), easies=Array{Downloads.Curl.Easy, (0,)}[], grace=0x0000000000007530)), timer=Base.Timer(handle=0x0000000105e327c0, cond=Base.GenericCondition{Base.Threads.SpinLock}(waitq=Base.IntrusiveLinkedList{Task}(head=<circular reference @-4>, tail=<circular reference @-4>), lock=Base.Threads.SpinLock(owned=0)), isopen=true, set=false)), rngState0=0x5c8325272148d0cf, rngState1=0xac2c5d63764b9943, rngState2=0x9b7a360faa44d102, rngState3=0x4b467f9f06452b2f, _state=0x00, sticky=true, _isexcep
...
41246] signal (11.2): Segmentation fault: 11
in expression starting at REPL[1]:1
get_item_for_reloc at /Users/kristoffercarlsson/.julia/juliaup/julia-1.9.0-rc2+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
jl_restore_system_image_from_stream_ at /Users/kristoffercarlsson/.julia/juliaup/julia-1.9.0-rc2+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
jl_restore_package_image_from_stream at /Users/kristoffercarlsson/.julia/juliaup/julia-1.9.0-rc2+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
ijl_restore_package_image_from_file at /Users/kristoffercarlsson/.julia/juliaup/julia-1.9.0-rc2+0.aarch64.apple.darwin14/lib/julia/libjulia-internal.1.9.dylib (unknown line)
StefanKarpinski commented 1 year ago

I have no idea how to debug this. Maybe @vtjnash could suggest something.

KristofferC commented 1 year ago

My guess is that the crash is not actually when precompiling but when loading the precompiled file. And then there is some task or something that is serialized and tries to get loaded and that breaks things. But just a guess.

StefanKarpinski commented 1 year ago

Does it only happen if you use the file pseudoprotocol?

KristofferC commented 1 year ago

Nope

KristofferC commented 1 year ago

Okay, the crash is actually not during precompile time. It crashes when loading the generated pkgimage file.