The vanilla nrepl connection command doesn't appear to work across JVM boots #280

Closed
samaaron opened this Issue Feb 18, 2013 · 3 comments

Projects

None yet

3 participants

@samaaron

With a fresh setup, I can run (nrepl "localhost" 1234) to connect to a running JVM instance. However, if I kill the JVM process and restart it, subsequent attempts to use the nrepl fn results in:

Debugger entered--Lisp error: (wrong-type-argument bufferp nil)
  buffer-local-value(nrepl-endpoint nil)
  #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4]("*nrepl-connection*<2>")
  cl-position(nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") 0 nil nil)
  position(nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") :if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4])
  apply(position nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") (:if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4]))
  find(nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") :if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4])
  apply(find nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") :if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4] nil)
  find-if(#[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4] ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*"))
  nrepl-check-for-nrepl-buffer(("localhost" 4555) nil)
  nrepl("localhost" 4555)
  eval((nrepl "localhost" 4555) nil)
  eval-last-sexp-1(nil)
  ad-Orig-eval-last-sexp(nil)
  #[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2]()
  funcall(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2])
  nrepl-eval-sexp-fu-flash-doit-simple(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)))
  funcall(nrepl-eval-sexp-fu-flash-doit-simple #[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)))
  nrepl-eval-sexp-fu-flash-doit(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)))
  (prog1 (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (setq ret t))
  (unwind-protect (prog1 (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (setq ret t)) (unless ret (funcall eflash)))
  (let (ret) (unwind-protect (prog1 (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (setq ret t)) (unless ret (funcall eflash))))
  (nesf-unwind-protect-with-tracking ret (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (unless ret (funcall eflash)))
  nesf-flash-doit(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-flash-error-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) (quote nrepl-eval-sexp-fu-flash-error) args)))
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  recursive-edit()
  debug(error (wrong-type-argument bufferp nil))
  buffer-local-value(nrepl-endpoint nil)
  #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4]("*nrepl-connection*<2>")
  cl-position(nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") 0 nil nil)
  position(nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") :if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4])
  apply(position nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") (:if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4]))
  find(nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") :if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4])
  apply(find nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") :if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4] nil)
  find-if(#[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4] ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*"))
  nrepl-check-for-nrepl-buffer(("localhost" 4555) nil)
  nrepl("localhost" 4555)
  eval((nrepl "localhost" 4555) nil)
  eval-last-sexp-1(nil)
  ad-Orig-eval-last-sexp(nil)
  #[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2]()
  funcall(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2])
  nrepl-eval-sexp-fu-flash-doit-simple(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)))
  funcall(nrepl-eval-sexp-fu-flash-doit-simple #[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)))
  nrepl-eval-sexp-fu-flash-doit(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)))
  (prog1 (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (setq ret t))
  (unwind-protect (prog1 (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (setq ret t)) (unless ret (funcall eflash)))
  (let (ret) (unwind-protect (prog1 (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (setq ret t)) (unless ret (funcall eflash))))
  (nesf-unwind-protect-with-tracking ret (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (unless ret (funcall eflash)))
  nesf-flash-doit(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-flash-error-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) (quote nrepl-eval-sexp-fu-flash-error) args)))
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  recursive-edit()
  debug(error (wrong-type-argument bufferp nil))
  buffer-local-value(nrepl-endpoint nil)
  #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4]("*nrepl-connection*<2>")
  cl-position(nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") 0 nil nil)
  position(nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") :if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4])
  apply(position nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") (:if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4]))
  find(nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") :if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4])
  apply(find nil ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*") :if #[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4] nil)
  find-if(#[(buffer) "\304�!�\n\203�\n\305\306\301J\"\232\206��\205��\305\307\301J\"\232)\207" [buffer --cl-buffer-- endpoint project-directory get-buffer buffer-local-value nrepl-endpoint nrepl-project-dir] 4] ("*nrepl-connection*<2>" "*nrepl-connection*" "*nrepl-connection*"))
  nrepl-check-for-nrepl-buffer(("localhost" 4555) nil)
  nrepl("localhost" 4555)
  eval((nrepl "localhost" 4555) nil)
  eval-last-sexp-1(nil)
  ad-Orig-eval-last-sexp(nil)
  #[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2]()
  funcall(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2])
  nrepl-eval-sexp-fu-flash-doit-simple(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)))
  funcall(nrepl-eval-sexp-fu-flash-doit-simple #[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)))
  nrepl-eval-sexp-fu-flash-doit(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)))
  (prog1 (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (setq ret t))
  (unwind-protect (prog1 (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (setq ret t)) (unless ret (funcall eflash)))
  (let (ret) (unwind-protect (prog1 (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (setq ret t)) (unless ret (funcall eflash))))
  (nesf-unwind-protect-with-tracking ret (nrepl-eval-sexp-fu-flash-doit do-it-thunk hi unhi) (unless ret (funcall eflash)))
  nesf-flash-doit(#[(&rest _it) "\302�!\211�\207" [eval-last-sexp-arg-internal ad-return-value ad-Orig-eval-last-sexp] 2] (closure (t) (&rest args) (apply (quote nesf-hl-highlight-bounds) (quote (825 . 849)) (quote nrepl-eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-hl-unhighlight-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote nesf-flash-error-bounds) (quote (825 . 849)) (quote #<buffer *scratch*>) (quote nrepl-eval-sexp-fu-flash-error) args)))
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
@hiredman

I've seen this exact error due to closing the nrepl server without letting nrepl.el know, nrepl.el deals that kind of thing very badly

@bbatsov
clojure-emacs member

@samaaron I guess we can handle this by catching that particular error and doing a reconnect behind the scenes. It will not be particularly robust, but it will be better user experience I guess.

@bbatsov
clojure-emacs member

Closing due to lack of activity (+ we're handling the death of the nREPL server reasonably gracefully these days).

@bbatsov bbatsov closed this Oct 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment