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:

julia> 

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

ERROR: LoadError: IOError: connect: connection refused (ECONNREFUSED)
Stacktrace:
 [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).

I have the same issue, I tried to disable terminal.integrated.enablePersistentSessions (both in the workspace and as a user, but it did not solve the issue – I also tried re-installing Julia just to check and that also did not fix the issue)

It seems to only happen when I try to make some of the custom subplots here:

For instance, the example plot:

using PlotlyJS

p = make_subplots(
rows=5, cols=2,
specs=[Spec() Spec(rowspan=2)
Spec() missing
Spec(rowspan=2, colspan=2) missing
missing missing
Spec() Spec()]
)

add_trace!(p, scatter(x=[1, 2], y=[1, 2], name=“(1,1)”), row=1, col=1)
add_trace!(p, scatter(x=[1, 2], y=[1, 2], name=“(1,2)”), row=1, col=2)
add_trace!(p, scatter(x=[1, 2], y=[1, 2], name=“(2,1)”), row=2, col=1)
add_trace!(p, scatter(x=[1, 2], y=[1, 2], name=“(3,1)”), row=3, col=1)
add_trace!(p, scatter(x=[1, 2], y=[1, 2], name=“(5,1)”), row=5, col=1)
add_trace!(p, scatter(x=[1, 2], y=[1, 2], name=“(5,2)”), row=5, col=2)

relayout!(p, height=600, width=600, title_text=“specs examples”)
p

I get the following error:

Error showing value of type PlotlyJS.SyncPlot:
ERROR: IOError: connect: connection refused (ECONNREFUSED)
Stacktrace:
[1] wait_connected(x::Sockets.TCPSocket)
@ Sockets ~/.julia/juliaup/julia-1.13.4+0.x64.linux.gnu/share/julia/stdlib/v1.13/Sockets/src/Sockets.jl:544
[2] connect
@ ~/.julia/juliaup/julia-1.13.4+0.x64.linux.gnu/share/julia/stdlib/v1.13/Sockets/src/Sockets.jl:579 [inlined]
[3] connect(addr::Sockets.IPv4, port::Int64)
@ Sockets ~/.julia/juliaup/julia-1.13.4+0.x64.linux.gnu/share/julia/stdlib/v1.13/Sockets/src/Sockets.jl:565
[4] try_connect(::Sockets.IPv4, ::Vararg{Any}; interval::Float64, attempts::Int64)
@ Blink.AtomShell ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:77
[5] try_connect
@ ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:74 [inlined]
[6] init(; debug::Bool)
@ Blink.AtomShell ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:91
[7] init
@ ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:85 [inlined]
[8] shell#5
@ ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:147 [inlined]
[9] shell
@ ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:138 [inlined]
[10] Blink.AtomShell.Window(args::Dict{String, Int64})
@ Blink.AtomShell ~/.julia/packages/Blink/tnO3a/src/AtomShell/window.jl:100
[11] display_blink(p::PlotlyJS.SyncPlot)
@ PlotlyJS ~/.julia/packages/PlotlyJS/Tl0he/src/display.jl:172
[12] display(::PlotlyJS.PlotlyJSDisplay, p::PlotlyJS.SyncPlot)
@ PlotlyJS ~/.julia/packages/PlotlyJS/Tl0he/src/display.jl:163
[13] display(x::Any)
@ Base.Multimedia ./multimedia.jl:340

Or with the setting disabled (and restarting VS Code) I get the following error:

Error showing value of type PlotlyJS.SyncPlot:
ERROR: IOError: connect: connection refused (ECONNREFUSED)
Stacktrace:
[1] wait_connected(x::Sockets.TCPSocket)
@ Sockets ~/.julia/juliaup/julia-1.13.4+0.x64.linux.gnu/share/julia/stdlib/v1.13/Sockets/src/Sockets.jl:544
[2] connect
@ ~/.julia/juliaup/julia-1.13.4+0.x64.linux.gnu/share/julia/stdlib/v1.13/Sockets/src/Sockets.jl:579 [inlined]
[3] connect(addr::Sockets.IPv4, port::Int64)
@ Sockets ~/.julia/juliaup/julia-1.13.4+0.x64.linux.gnu/share/julia/stdlib/v1.13/Sockets/src/Sockets.jl:565
[4] try_connect(::Sockets.IPv4, ::Vararg{Any}; interval::Float64, attempts::Int64)
@ Blink.AtomShell ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:77
[5] try_connect
@ ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:74 [inlined]
[6] init(; debug::Bool)
@ Blink.AtomShell ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:91
[7] init
@ ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:85 [inlined]
[8] shell#5
@ ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:147 [inlined]
[9] shell
@ ~/.julia/packages/Blink/tnO3a/src/AtomShell/process.jl:138 [inlined]
[10] Blink.AtomShell.Window(args::Dict{String, Int64})
@ Blink.AtomShell ~/.julia/packages/Blink/tnO3a/src/AtomShell/window.jl:100
[11] display_blink(p::PlotlyJS.SyncPlot)
@ PlotlyJS ~/.julia/packages/PlotlyJS/Tl0he/src/display.jl:172
[12] display(::PlotlyJS.PlotlyJSDisplay, p::PlotlyJS.SyncPlot)
@ PlotlyJS ~/.julia/packages/PlotlyJS/Tl0he/src/display.jl:163
[13] display(x::Any)
@ Base.Multimedia ./multimedia.jl:340

Things do, however, seem to work when I run them inside of the REPL terminal inside of VS Code, but this is, of course, not ideal.