Restore session in VSCode: ERROR: LoadError: IOError: connect: connection refused (ECONNREFUSED)

In one computer, when I restart VScode, I’m getting this error in the Julia session:


 Session contents restored from 3/17/2022 at 9:30:27 AM 

ERROR: LoadError: IOError: connect: connection refused (ECONNREFUSED)
 [1] wait_connected(x::Base.PipeEndpoint)
   @ Sockets ~/.julia/juliaup/julia-1.7.2+0~x64/share/julia/stdlib/v1.7/Sockets/src/Sockets.jl:532
 [2] connect
   @ ~/.julia/juliaup/julia-1.7.2+0~x64/share/julia/stdlib/v1.7/Sockets/src/Sockets.jl:567 [inlined]
 [3] connect
   @ ~/.julia/juliaup/julia-1.7.2+0~x64/share/julia/stdlib/v1.7/Sockets/src/PipeServer.jl:97 [inlined]
 [4] serve(args::String; is_dev::Bool, crashreporting_pipename::String)
   @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/VSCodeServer/src/VSCodeServer.jl:100
 [5] top-level scope
   @ ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/terminalserver/terminalserver.jl:45
in expression starting at /home/leandro/.vscode/extensions/julialang.language-julia-1.5.11/scripts/terminalserver/terminalserver.jl:24

I don’t really expect to have a recovered Julia session on restart, so maybe I just want do disable the automatic Julia session launching that happens whenever I open it.

Or is it something that should be working better?

To be clear: this happens only if I quit VSCode without manually ending the Julia session (the REPL), which causes it the automatically restart when I open VSCode back.

I have the same issue for a while now.

Also worth mentioning that the session opened automatically on startup is broken here, any command takes forever. So there is no other option other than quitting it and starting a new session.

Disable the terminal.integrated.enablePersistentSessions setting. Next release of the extension plays well with the persistent sessions functionality built into VS Code (aka can opt out of it).