nrepl

https://github.com/nrepl/nrepl || https://nrepl.org
Jakub Holý 2020-07-08T09:04:04.141600Z

Hello! Why does running 0.8.0-alpha5 via tools deps with :main-opts ["-m" "nrepl.cmdline" "--port" "9832"] fail with > Execution error (AssertionError) at nrepl.core/connect (core.clj:168). > Assert failed: port ? I expected it to start the server at the given port, not trying to connect to one?! What do I do wrong? Thank you!

✅ 1
flowthing 2020-07-08T09:06:46.141700Z

How are you invoking clojure? I have an alias like this in my deps.edn:

:aliases {:nrepl/server {:extra-deps {nrepl {:mvn/version "0.8.0-alpha5"}}
                         :main-opts ["--main" "nrepl.cmdline" "--port" "1234"]}}
And I invoke it like this:
$ clojure -A:nrepl/server
And it works fine.

flowthing 2020-07-08T09:08:10.142100Z

Also, have you tried -Srepro ? Maybe there’s something in your ~/.clojure/deps.edn that causes the issue.

flowthing 2020-07-08T09:08:35.142300Z

(Also, on an unrelated note, I absolutely despise how Slack won’t let me just use Markdown any more…)

💯 1
Jakub Holý 2020-07-08T09:17:48.142900Z

Thanks a lot! The solution was simple: rm ~/.clojure/deps.edn 🙂 I had the nrepl profile defined there as well, differently. Surprisingly the local deps.edn does not take precedence...

flowthing 2020-07-08T09:18:53.143200Z

Well, you could have just removed the alias instead of deleting the whole file, but I’m glad the issue’s solved. 🙂

Jakub Holý 2020-07-08T09:26:13.143400Z

sure 🙂

Jakub Holý 2020-07-08T09:32:37.144700Z

Question 2: After having started a server as described above ☝️ I try to connect to it (same options plus --connect ) but it fails with > Exception starting REPL: java.lang.IllegalStateException: Could not open new session; :clone response Why? Thank you!

✅ 1
Jakub Holý 2020-07-08T09:34:57.145100Z

☝️ fixed it by downgrading to alpha1

flowthing 2020-07-08T09:41:51.145200Z

$ clojure -Srepro -Sdeps '{:deps {nrepl {:mvn/version "0.8.0-alpha5"}}}' --main nrepl.cmdline --port 1234
Followed by:
clojure -Srepro -Sdeps '{:deps {nrepl {:mvn/version "0.8.0-alpha5"}}}' --main nrepl.cmdline --connect --port 1234
Seems to work for me.

flowthing 2020-07-08T09:42:57.145400Z

You could maybe add -J-Dclojure.main.report=stderr to your command-line invocation and show us the full stack trace — that might be helpful.

Jakub Holý 2020-07-08T12:37:24.145600Z

Thank you! I found the problem. I am running it inside a Docker container and thought that the default bind addr. of 127.0.0.1 is ok when I map the docker port to a local port but obviously not. So the fix was to add -b 0.0.0.0 to the server inside Docker