Fork me on GitHub
#cider
<
2022-02-05
>
geoff22:02:50

Hi I’m getting the following error when connecting to a running repl with (cider-connect-clj '(:host "localhost" :port 5555 :project-dir "~/devel/")): Error: (error "Sync nREPL request timed out (op clone id 5)") The repl was started with -Dclojure.server.repl={:port 5555 :accept clojure.core.server/repl} Debugger error:

Debugger entered--Lisp error: (error "Sync nREPL request timed out (op eval code (seq (.split (System/getProperty \"java.class.path\") \":\"))...")
  signal(error ("Sync nREPL request timed out (op eval code (seq (...."))
  error("Sync nREPL request timed out %s" ("op" "eval" "code" "(seq (.split (System/getProperty \"java.class.path\"..." "id" "2"))
  nrepl-send-sync-request(("op" "eval" "code" "(seq (.split (System/getProperty \"java.class.path\"..." "id" "2") #<buffer *cider-uninitialized-repl*> nil tooling)
  nrepl-sync-request:eval("(seq (.split (System/getProperty \"java.class.path\"..." #<buffer *cider-uninitialized-repl*> nil tooling)
  cider-sync-tooling-eval("(seq (.split (System/getProperty \"java.class.path\"...")
  cider-fallback-eval:classpath()
  cider-classpath-entries()
  #f(compiled-function (system session) "Check if SESSION is a friendly session." #<bytecode 0x460f1c0f>)(CIDER ("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>))
  apply(#f(compiled-function (system session) "Check if SESSION is a friendly session." #<bytecode 0x460f1c0f>) CIDER ("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>))
  sesman-friendly-session-p(CIDER ("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>))
  #f(compiled-function (ses) #<bytecode 0x461a2e83>)(("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>))
  #f(compiled-function (elt) #<bytecode 0x461a2eb5>)(("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>))
  mapcar(#f(compiled-function (elt) #<bytecode 0x461a2eb5>) (("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>)))
  #f(compiled-function #'sequence #<bytecode 0x4ac2b6a3>)(#f(compiled-function (elt) #<bytecode 0x461a2eb5>) (("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>)))
  apply(#f(compiled-function #'sequence #<bytecode 0x4ac2b6a3>) #f(compiled-function (elt) #<bytecode 0x461a2eb5>) (("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>)) nil)
  seq-map(#f(compiled-function (elt) #<bytecode 0x461a2eb5>) (("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>)))
  seq-filter(#f(compiled-function (ses) #<bytecode 0x461a2e83>) (("devel/canto:localhost:5555" #<buffer *cider-uninitialized-repl*>)))
  sesman--friendly-sessions(CIDER sort)
  sesman-current-sessions(CIDER (project))
  cider--check-existing-session((:host "localhost" :port 5555 :project-dir "~/devel/canto/" :repl-init-function nil :session-name nil :repl-type clj))
  cider-connect-clj((:host "localhost" :port 5555 :project-dir "~/devel/canto/" :repl-init-function nil :session-name nil :repl-type clj))
  canto-connect-to-nrepl()
  eval((canto-connect-to-nrepl) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp) 

dpsutton23:02:29

You are connecting an nrepl client to a regular socket repl. That will not work

🙌 1
geoff23:02:44

ah, right

dpsutton23:02:14

inf-clojure will happily do this but there’s a big difference in what inf-clojure and CIDER provide

dpsutton23:02:36

(this is how i’ve developed for the last 14 months though)

geoff23:02:48

is there a way to start the nrepl server with a command line arg as I’ve done with the normal socket server above?

geoff23:02:00

or what’s the recommended way?

dpsutton23:02:44

yes and no. The benefit of clojure’s socket repl is that clojure main will start that on initialization. Nrepl obviously cannot share this benefit since it is third party. You need use the main entry to start the nrepl server or have code that will start an nrepl server for you

dpsutton23:02:07

The easiest way to do this is just to cider-jack-in and then see the startup command listed at the top of the repl and duplicate this

dpsutton23:02:34

An alternative is to just use whatever main your program is using and add some code that will optionally start up an nrepl server with cider-nrepl middleware involved

geoff23:02:05

> add some code that will optionally start up an nrepl server with cider-nrepl middleware involved I think this might be the go for me, thanks!

geoff23:02:30

worked like a charm, cheers

🎉 1