RemoteREPL.jl icon indicating copy to clipboard operation
RemoteREPL.jl copied to clipboard

Does not work in julia 1.11.5

Open Liozou opened this issue 8 months ago • 2 comments

This is a very nice package, thank you for developing it! Unfortunately it seems not to work if the client uses Julia 1.11.5. For example, after opening a server (using Julia 1.11.5) serving on port 12121, there is no issue if the client is on Julia v1.11.4:

julia> VERSION
v"1.11.4"

julia> using RemoteREPL

julia> connect_repl(12121)
[ Info: Using session id 20ade862-1cc6-40d7-83ca-c09254de176b
REPL mode remote_repl initialized. Press > to enter and backspace to exit.
"Prompt(\"julia@localhost:12121> \",...)"

julia@localhost:12121> 1+5
6

However, if the client is on Julia v1.11.5 it crashes with an illegible stacktrace, because the REPL throws an error while trying to show the error...

julia> VERSION
v"1.11.5"

julia> using RemoteREPL

julia> connect_repl(12121)
[ Info: Using session id 8de7c9f9-30c3-432d-b712-ad13a1dcf628
REPL mode remote_repl initialized. Press > to enter and backspace to exit.
"Prompt(\"julia@localhost:12121> \",...)"

julia@localhost:12121> 1 + 3

SYSTEM (REPL): showing an error caused an error
ERROR: MethodError: no method matching stacktrace(::MethodError)
The function `stacktrace` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  stacktrace(::Bool)
   @ Base stacktraces.jl:174
  stacktrace()
   @ Base stacktraces.jl:174
  stacktrace(::Vector{<:Union{Ptr{Nothing}, Base.InterpreterIP, Core.Compiler.InterpreterIP}}, ::Bool)
   @ Base stacktraces.jl:161
  ...

Stacktrace:
  [1] scrub_repl_backtrace(bt::MethodError)
    @ Base ./client.jl:101
  [2] print_response(errio::IO, response::Any, backend::Union{Nothing, REPL.REPLBackendRef}, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:429
  [3] (::REPL.var"#70#71"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:405
  [4] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:678
  [5] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:403
  [6] (::REPL.var"#do_respond#100"{Bool, Bool, RemoteREPL.var"#56#58"{Base.TTY, RemoteREPL.Connection}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:1035
  [7] #invokelatest#2
    @ ./essentials.jl:1055 [inlined]
  [8] invokelatest
    @ ./essentials.jl:1052 [inlined]
  [9] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2755
 [10] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:1506
 [11] (::REPL.var"#79#85"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ~/.julia/juliaup/julia-1.11.5+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:497

In both cases I am using RemoteREPL.jl v0.3.0.

Liozou avatar Apr 25 '25 16:04 Liozou

Did you have to do anything special to get it working with Julia 1.11.4?

It works fine with 1.10, but all versions of 1.11 fail for me with

julia> connect_repl()
[ Info: Using session id d6eae001-ee02-4470-aecb-cd35ba67af7e
ERROR: MethodError: Cannot `convert` an object of type REPL.LineEdit.Prompt to an object of type REPL.LineEdit.TextInterface
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:126

Stacktrace:
 [1] push!(a::Vector{REPL.LineEdit.TextInterface}, item::REPL.LineEdit.Prompt)
   @ Base ./array.jl:1260
 [2] initrepl(parser::RemoteREPL.var"#56#58"{…}; prompt_text::Function, prompt_color::Symbol, start_key::Char, repl::REPL.LineEditREPL, mode_name::String, show_function::Nothing, show_function_io::Base.TTY, valid_input_checker::Function, keymap::Dict{…}, completion_provider::RemoteREPL.RemoteCompletionProvider, sticky_mode::Bool, startup_text::Bool)
   @ ReplMaker ~/data/dot_julia/packages/ReplMaker/ViCwA/src/ReplMaker.jl:81
 [3] connect_repl(host::Sockets.IPv4, port::Int64; tunnel::Symbol, ssh_opts::Cmd, region::Nothing, namespace::Nothing, startup_text::Bool, repl::REPL.LineEditREPL, session_id::Nothing)
   @ RemoteREPL ~/data/dot_julia/packages/RemoteREPL/uZRbF/src/client.jl:494
 [4] connect_repl(host::Sockets.IPv4, port::Int64)
   @ RemoteREPL ~/data/dot_julia/packages/RemoteREPL/uZRbF/src/client.jl:483
 [5] top-level scope
   @ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.

robsmith11 avatar Oct 04 '25 00:10 robsmith11

No special trick no, I'm using v1.11.4 on both server and client ends, is that the case for you too?

I simply run julia +1.11.4 --startup-file=no --project=@temp on both server and client ends. The server code is:

julia> using RemoteREPL

julia> x = 17
17

julia> serve_repl(12121)

and the client session is:

julia> using RemoteREPL

julia> connect_repl(12121)
[ Info: Using session id 27b8ca79-d1dc-4b76-9ec9-b8c74b23cf98
REPL mode remote_repl initialized. Press > to enter and backspace to exit.
"Prompt(\"julia@localhost:12121> \",...)"

julia@localhost:12121> x
17

My versioninfo:

Julia Version 1.11.4
Commit 8561cc3d68d (2025-03-10 11:36 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 48 × Intel(R) Xeon(R) Silver 4214R CPU @ 2.40GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, cascadelake)
Threads: 1 default, 0 interactive, 1 GC (on 48 virtual cores)

I'm using RemoteRepl v0.3.0

Liozou avatar Oct 07 '25 06:10 Liozou