Fork me on GitHub
#nrepl
<
2019-02-23
>
devth01:02:04

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

devth01:02:17

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

devth01:02:48

or telnet

devth01:02:57

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

devth03:02:21

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?

hiredman03:02:22

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

devth16:02:58

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")

devth16:02:29

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

hiredman03:02:31

the jvm might be prefering the ipv6 address for localhost