I have a very weird issue in the REPL with one of my packages. Unfortunately it’s very hard to boil it down to an MWE but I can already provide something which people can easily reproduce.
You’ll need to add our public registry and install two packages (which only depend on packages from the general registry):
julia> using Pkg; Pkg.Registry.add(); Pkg.Registry.add(RegistrySpec(url = "https://git.km3net.de/common/julia-registry"))
julia> Pkg.add(name="KM3io", version="0.18.8")
julia> Pkg.add("KM3NeTTestData") # version doesn't matter, it's just sample files
Then the following happens in the REPL and this is all we are doing (empty startup.jl
):
julia> using KM3io, KM3NeTTestData
julia> f = ROOTFile(datapath("offline", "numucc.root"))
ROOTFile{OnlineTree (0 events, 0 summaryslices), OfflineTree (10 events)}
julia> f.offline[1].
Right after typing f.offline[1].
(the dot is actually the last character which prints immediately), the REPL freezes for many seconds and only the deletion of characters is immedate, every other keystroke introduces another lag of several seconds.
Tab completion is affected as well of course, I guess that just counts as a keystroke. On some machines, the lag does not start just by typing but tab completion is extremely laggy.
Apparently there is something heavy is happening in the REPL when getindex
is involved followed by the dot for field access. I can see in the activity monitor that one julia
process is going to 100% CPU.
The corresponding line in KM3io.jl
is here: KM3io.jl/src/root/offline.jl at db133f40af8f3681d51807ae4c2d646f3c5e259c · KM3NeT/KM3io.jl · GitHub and I even tried to add a return type hint with ::Evt
, since the function is guaranteed to return an Evt
, so I am wondering why the REPL cannot figure this out easily. Where does it choke?
I hope that someone who has a better understanding on what REPL.jl is doing (and the recent changes introduced in Julia 1.11) under the hood can kick me in the right direction because at this moment I have little idea where to start Maybe it’s related to some compilations triggering in the background…
The problem does not appear up to Julia v1.10.7, it starts with Julia v1.11.0. The latest I tried was 1.11.5 and also v1.12.0-beta4 on macOS 15.3 with an M1 CPU and also on Ubuntu Linux with a beefy Intel Xeon (the amount of threads does not matter, I tried with -t 128
)
Btw. I also tried to disable the hint_tab_completes
option in the ~/.julia/config/startup.jl
because that was our best guess so far, but it did not help:
atreplinit() do repl
if VERSION >= v"1.11.0-0"
repl.options.hint_tab_completes = false
end
end