nrepl

https://github.com/nrepl/nrepl || https://nrepl.org
devth 2019-02-23T01:40:04.022800Z

what would be a minimal example of hitting an nrepl, e.g. using something like netcat?

devth 2019-02-23T01:40:17.023100Z

i.e. what's the hello world of nrepl?

devth 2019-02-23T01:52:48.023300Z

or telnet

devth 2019-02-23T01:53:57.023700Z

ok so apparently you can't use telnet unless you set the tty transport

devth 2019-02-23T03:03:21.026Z

trying to connect to an nrepl inside a docker container on a remote server. in docker i expose the nrepl (port 65432) to the host. then i ssh to the host with port forwarding:

ssh -vNL 40000:localhost:65432 my-remote-host
i verify there's a connection (at least i think this means it worked)
nc -vv localhost 40000
found 0 associations
found 1 connections:
     1: flags=82<CONNECTED,PREFERRED>
        outif lo0
        src ::1 port 65316
        dst ::1 port 40000
        rank info not available
        TCP aux info available

Connection to localhost port 40000 [tcp/safetynetp] succeeded!
then try to connect a repl client:
lein repl :connect localhost:40000
Warning: implicit middleware found: cider-nrepl.plugin/middleware
Please declare all middleware in :middleware as implicit loading is deprecated.
Connecting to nREPL at localhost:40000
SocketException The transport's socket appears to have lost its connection to the nR
EPL server
        nrepl.transport/bencode/fn--5187/fn--5188 (transport.clj:95)
        nrepl.transport/bencode/fn--5187 (transport.clj:95)
        nrepl.transport/fn-transport/fn--5159 (transport.clj:42)
        clojure.core/binding-conveyor-fn/fn--4676 (core.clj:1938)
        java.util.concurrent.FutureTask.run (FutureTask.java:264)
        java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1
128)
        java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:
628)
        java.lang.Thread.run (Thread.java:834)
Bye for now!
logs from ssh tunnel:
debug1: Connection to port 40000 forwarding to localhos
t port 65432 requested.
debug2: fd 8 setting TCP_NODELAY
debug1: channel 3: new [direct-tcpip]
debug2: channel 3: open confirm rwindow 2097152 rmax 32
768
debug2: channel 3: rcvd eof
debug2: channel 3: output open -> drain
debug2: channel 3: obuf empty
debug2: channel 3: chan_shutdown_write (i0 o1 sock 8 wf
d 8 efd -1 [closed])
debug2: channel 3: output drain -> closed
debug2: channel 3: read<=0 rfd 8 len 0
debug2: channel 3: read failed
debug2: channel 3: chan_shutdown_read (i0 o3 sock 8 wfd
 8 efd -1 [closed])
debug2: channel 3: input open -> drain
debug2: channel 3: ibuf empty
debug2: channel 3: send eof
debug2: channel 3: input drain -> closed
debug2: channel 3: send close
debug2: channel 3: rcvd close
debug2: channel 3: is dead
debug2: channel 3: garbage collecting
debug1: channel 3: free: direct-tcpip: listening port 4
0000 for localhost port 65432, connect from 127.0.0.1 p
ort 49790 to 127.0.0.1 port 40000, nchannels 4
any ideas?

2019-02-23T03:38:22.026800Z

what OS? I would try 127.0.0.1 explicitly in the lein connect command

devth 2019-02-23T16:50:58.029400Z

macos locally. ubuntu 16.04 on the server tried 127.0.0.1 - same problem i'm starting the nrepl like:

(nrepl/start-server :port nrepl-port :bind "localhost")

devth 2019-02-23T16:51:29.029700Z

verified i can: 1. ssh to host 2. docker exec into container 3. run lein connect and get a repl

2019-02-23T03:39:31.028200Z

the jvm might be prefering the ipv6 address for localhost

rgm 2019-02-23T05:39:33.028300Z

Victory! OK … so I needed to do a couple things:

rgm 2019-02-23T05:44:48.028600Z

1. bump to 0.4.1-SNAPSHOT, 2. Patch fireplace.vim, 3. Make sure a cljs-repl was started in the terminal REPL, before trying to run :Piggieback