-
Notifications
You must be signed in to change notification settings - Fork 25
Debugging Remote REPL SSH Tunnels
Sometimes, remote REPL sessions fail to start. This wiki page collects some ideas about how to go about debugging this problem.
One way to understand what may have gone wrong is to get Emacs out of the
picture and understand what happens with the SSH tunnel. To do this, use netcat
(nc
) to send commands from the local machine (client) to the Snail server on
the cluster. (You may have to install netcat from your OS package manager.)
-
Clean up all stray
julia
instances on the remote host. -
Shut down all SSH connections from your local machine to the remote host.
-
Copy
JuliaSnail.jl
,Project.toml
, andManifest.toml
from the Snail package (or directly from GitHub) to some directory on your remote host. -
Start the ssh tunnel:
ssh -t -L 10069:localhost:10099 remotehost /path/to/julia/binary -L /path/to/JuliaSnail.jl/on/remote/host
-
When the Julia REPL pops up, run
JuliaSnail.start(10099)
and wait for the prompt. -
From your local machine, run this:
echo '(reqid = "abcd1234", ns = [:Main], code = "println(\"hello world\")")' | nc localhost 10069
This should print hello world to your Julia REPL and error out with a message like IOError: stream is closed or unusable
.
If the Snail server fails to start on the remote host with an error like
EADDRINUSE
, then replace 10099 with a different port number in both the SSH
tunnel call and the JuliaSnail.start
call. If that still does not work,
something prevents you from opening up server sockets on the remote host, and
you should ask your system administration staff for an explanation.
If the Snail server starts but there is no output in the Julia REPL from the
nc
call, your tunnel is not being set up correctly. Maybe it’s your local
machine, maybe it’s a firewall, maybe it’s configuration, and maybe it’s
something else.
If everything works without Emacs, but does not work inside Emacs, then maybe your Snail installation is broken. Blow it away completely (delete from disk), reinstall from MELPA or GitHub, and restart Emacs.