Fork me on GitHub
#nrepl
<
2020-07-08
>
Jakub Holý (HolyJak)09:07:04

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!

3
flowthing09:07:46

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.

flowthing09:07:10

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

flowthing09:07:35

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

💯 3
Jakub Holý (HolyJak)09:07:48

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...

flowthing09:07:53

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

Jakub Holý (HolyJak)09:07:37

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!

3
flowthing09:07:51

$ 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.

flowthing09:07:57

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ý (HolyJak)12:07:24

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

Jakub Holý (HolyJak)09:07:57

☝️ fixed it by downgrading to alpha1