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

Failed to precompile LanguageServer #1024

Closed
davidanthoff opened this issue Mar 2, 2020 · 9 comments
Closed

Failed to precompile LanguageServer #1024

davidanthoff opened this issue Mar 2, 2020 · 9 comments
Assignees

Comments

@davidanthoff
Copy link
Member

From crash reporting.

Message:

Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to /home/XXX/.vscode-server/extensions/julialang.language-julia-0.14.11/scripts/languageserver/julia_pkgdir/compiled/v1.3/LanguageServer/ite7n_1PXbZ.ji. 

Stack trace:

ErrorException:
   at error(::String) (error.jl33)
   at compilecache(::Base.PkgId, ::String) (loading.jl1283)
   at _require(::Base.PkgId) (loading.jl1024)
   at require(::Base.PkgId) (loading.jl922)
   at require(::Module, ::Symbol) (loading.jl917)
   at top-level scope (./scripts/languageserver/main.jl25)
   at include (boot.jl328)
   at include_relative(::Module, ::String) (loading.jl1105)
   at include(::Module, ::String) (Base.jl31)
   at exec_options(::Base.JLOptions) (client.jl287)
   at _start() (client.jl460)

We get a lot of crash reports like that... The existing error message is kind of too sparse to tell what is going on, but it is tricky to figure out how we could get more info... The only idea I have is to capture the whole stderr of the LS process into a buffer and send that with the crash reporting. But that would mean that nothing is shown in the output log for the LS in VS Code anymore, which seems really not ideal.

I also have no idea what might make precompile fail... Some ideas: maybe multiple instances of VS Code that all try to precompile at the same time and get into each other's way? Or maybe the VS Code extension is installed in a read-only location? The former seems kind of more likely to me...

@davidanthoff davidanthoff added this to the v0.14.0 milestone Mar 2, 2020
@davidanthoff davidanthoff added this to To do in Current via automation Mar 2, 2020
@davidanthoff
Copy link
Member Author

I looked into this, and I'm pretty positive that this is simply the known problem that if two Julia instances try to precompile the same stuff, one (or both) crash. So it is enough to have two instances of VS Code that start the LS at the same time for the first time to trigger this.

I don't think there is anything we can do, other than hope that someone finishes JuliaLang/julia#30174.

@davidanthoff davidanthoff removed this from To do in Current Mar 10, 2020
@davidanthoff davidanthoff modified the milestones: v0.14.x, Backlog Mar 10, 2020
@matu3ba
Copy link

matu3ba commented Oct 21, 2020

@davidanthoff
EDIT This PR should fix the issue.

Sorry for the ping. I did not look up the PRs.

@davidanthoff
Copy link
Member Author

I think this is fixed in Julia 1.6

@MrVPlusOne
Copy link

Hi, I'm still getting a similar error in Julia 1.6:

[ Info: Precompiling VSCodeServer [9f5989ce-84fe-42d4-91ec-6a7a8d53ed0f]
ERROR: UndefVarError: PkgId not defined
Stacktrace:
 [1] top-level scope
   @ none:1
 [2] eval
   @ ./boot.jl:360 [inlined]
 [3] eval(x::Expr)
   @ Base.MainInclude ./client.jl:446
 [4] top-level scope
   @ none:1
ERROR: LoadError: Failed to precompile VSCodeServer [9f5989ce-84fe-42d4-91ec-6a7a8d53ed0f] to /Users/jiayiwei/.julia/compiled/v1.6/VSCodeServer/jl_qHKDod.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::PkgId, path::String, internal_stderr::TTY, internal_stdout::TTY)
   @ Base ./loading.jl:1360
 [3] compilecache(pkg::PkgId, path::String)
   @ Base ./loading.jl:1306
 [4] _require(pkg::PkgId)
   @ Base ./loading.jl:1021
 [5] require(uuidkey::PkgId)
   @ Base ./loading.jl:914
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:901
in expression starting at /Users/jiayiwei/.vscode/extensions/julialang.language-julia-insider-1.1.37/scripts/terminalserver/terminalserver.jl:4

I was previously using Julia 1.5 on macOS and everything was working properly, but whenever I tried to switch to Julia 1.6 (by updating the Julia executable path) I get this error if I open the Julia REPL inside VS Code. Switching the path back to Julia 1.5 makes this error go away. I was not running multiple VS Code instances though. This has been blocking me from switching to Julia 1.6 since the RC versions. Do you have any idea what's causing this? Thanks!

@MrVPlusOne
Copy link

Ok never mind, I have fixed the issue. It turns out the precompilation of VSCode somehow depends on how types are printed, and I was using SimpleTypePrint in my startup.jl, which overrides how types are shown (eg., PkgId instead of Base.PkgId). The precompilation succeeded when SimplyTypePrint was turned off.

@amgawishx
Copy link

Eh, I am using Julia 1.7 and it sill persists:

[ Info: Starting the Julia Language Server
ERROR: LoadError: (Vararg{Any}, Core.TypeofVararg)
Stacktrace:
  [1] error(s::Tuple{Core.TypeofVararg, DataType})
    @ Base .\error.jl:42
  [2] SymbolServer.FakeTypeName(x::Any; justname::Bool)
    @ SymbolServer c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\SymbolServer\src\faketypes.jl:40
  [3] FakeTypeName
    @ c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\SymbolServer\src\faketypes.jl:18 [inlined]
  [4] cache_methods(f::Any, name::Symbol, env::Dict{Symbol, SymbolServer.ModuleStore})
    @ SymbolServer c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\SymbolServer\src\symbols.jl:174
  [5] symbols(env::Dict{Symbol, SymbolServer.ModuleStore}, m::Module, allnames::Base.IdSet{Symbol}, visited::Base.IdSet{Module})
    @ SymbolServer c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\SymbolServer\src\symbols.jl:403
  [6] symbols(env::Dict{Symbol, SymbolServer.ModuleStore}, m::Nothing, allnames::Base.IdSet{Symbol}, visited::Base.IdSet{Module})
    @ SymbolServer c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\SymbolServer\src\symbols.jl:433
  [7] symbols (repeats 3 times)
    @ c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\SymbolServer\src\symbols.jl:380 [inlined]
  [8] load_core()
    @ SymbolServer c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\SymbolServer\src\symbols.jl:442
  [9] top-level scope
    @ c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\SymbolServer\src\SymbolServer.jl:203
 [10] include
    @ .\Base.jl:418 [inlined]
 [11] 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, UInt64}}, source::String)
    @ Base .\loading.jl:1318
 [12] top-level scope
    @ none:1
 [13] eval
    @ .\boot.jl:373 [inlined]
 [14] eval(x::Expr)
    @ Base.MainInclude .\client.jl:453
 [15] top-level scope
    @ none:1
in expression starting at c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\SymbolServer\src\SymbolServer.jl:1
ERROR: LoadError: Failed to precompile SymbolServer [cf896787-08d5-524d-9de7-132aaa0cb996] to c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\languageserver\julia_pkgdir\compiled\v1.7\SymbolServer\jl_55DF.tmp.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base .\loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base .\loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:997
  [7] include
    @ .\Base.jl:418 [inlined]
  [8] 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, UInt64}}, source::String)
    @ Base .\loading.jl:1318
  [9] top-level scope
    @ none:1
 [10] eval
    @ .\boot.jl:373 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude .\client.jl:453
 [12] top-level scope
    @ none:1
in expression starting at c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\LanguageServer\src\LanguageServer.jl:1
┌ Warning: Some Julia code in the VS Code extension crashed with
│   e = Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\languageserver\julia_pkgdir\compiled\v1.7\LanguageServer\jl_1F98.tmp.
└ @ Main c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\error_handler.jl:5
ERROR: Failed to precompile LanguageServer [2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7] to c:\Users\kxdragon\.vscode\extensions\julialang.language-julia-1.0.10\scripts\languageserver\julia_pkgdir\compiled\v1.7\LanguageServer\jl_1F98.tmp.

@pfitzseb
Copy link
Member

pfitzseb commented Jun 7, 2022

You're using a very old version of the extension. Please update.

@amgawishx
Copy link

amgawishx commented Jun 7, 2022

I literally just installed it from the marketplace in vscode
Edit: That's odd, it is really a really old version, yet vscode marketplace shows it to me as the latest, I don't understand why

@pfitzseb
Copy link
Member

pfitzseb commented Jun 7, 2022

It's very likely you're on an old version of VS Code itself.

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

No branches or pull requests

6 participants