Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stacktraces don't show until cider-stacktrace is manually evaluated #586

Closed
hugoduncan opened this issue May 28, 2014 · 8 comments
Closed
Milestone

Comments

@hugoduncan
Copy link
Member

I'm seeing an issue with stacktraces that causes them not to be shown until cider-stacktrace.el is manually evaluated. This is with cider installed from melpa using cask. As far as I can tell I only have one version of cider on my load-path, and no out of date .elc files.

After evaluating an expression that causes an exception to be thrown, I see in *messages*:

Error: (wrong-type-argument integer-or-marker-p nil)
Error: (void-variable message)

The *cider-error* buffer is made visible, but is empty.

Turning on debug-on-error results in the following stack trace. I have been unable to get a stacktrace for the void-variable error, which seems to be the root cause of the exceptions not displaying properly.

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (let ((start (point)) (end (byte-to-position (+ (position-bytes (point)) (string-to-number (match-string 1)))))) (goto-char end) (buffer-substring-no-properties start end))
  (cond ((looking-at "i\\(-?[0-9]+\\)e") (goto-char (match-end 0)) (string-to-number (match-string 1))) ((looking-at "\\([0-9]+\\):") (goto-char (match-end 0)) (let ((start (point)) (end (byte-to-position (+ (position-bytes ...) (string-to-number ...))))) (goto-char end) (buffer-substring-no-properties start end))) ((looking-at "l") (goto-char (match-end 0)) (let (result item) (while (not (eq :end (setq item (nrepl-bdecode-buffer)))) (setq result (cons item result))) (nreverse result))) ((looking-at "d") (goto-char (match-end 0)) (let (dict key item) (while (not (eq :end (setq item (nrepl-bdecode-buffer)))) (if key (setq dict (cons (cons key item) dict) key nil) (if (stringp item) nil (error "Dictionary keys have to be strings: %s" item)) (setq key item))) (cons (quote dict) (nreverse dict)))) ((looking-at "e") (goto-char (match-end 0)) :end) (t (error "Cannot decode object: %d" (point))))
  nrepl-bdecode-buffer()
  (setq item (nrepl-bdecode-buffer))
  (eq :end (setq item (nrepl-bdecode-buffer)))
  (not (eq :end (setq item (nrepl-bdecode-buffer))))
  (while (not (eq :end (setq item (nrepl-bdecode-buffer)))) (if key (setq dict (cons (cons key item) dict) key nil) (if (stringp item) nil (error "Dictionary keys have to be strings: %s" item)) (setq key item)))
  (let (dict key item) (while (not (eq :end (setq item (nrepl-bdecode-buffer)))) (if key (setq dict (cons (cons key item) dict) key nil) (if (stringp item) nil (error "Dictionary keys have to be strings: %s" item)) (setq key item))) (cons (quote dict) (nreverse dict)))
  (cond ((looking-at "i\\(-?[0-9]+\\)e") (goto-char (match-end 0)) (string-to-number (match-string 1))) ((looking-at "\\([0-9]+\\):") (goto-char (match-end 0)) (let ((start (point)) (end (byte-to-position (+ (position-bytes ...) (string-to-number ...))))) (goto-char end) (buffer-substring-no-properties start end))) ((looking-at "l") (goto-char (match-end 0)) (let (result item) (while (not (eq :end (setq item (nrepl-bdecode-buffer)))) (setq result (cons item result))) (nreverse result))) ((looking-at "d") (goto-char (match-end 0)) (let (dict key item) (while (not (eq :end (setq item (nrepl-bdecode-buffer)))) (if key (setq dict (cons (cons key item) dict) key nil) (if (stringp item) nil (error "Dictionary keys have to be strings: %s" item)) (setq key item))) (cons (quote dict) (nreverse dict)))) ((looking-at "e") (goto-char (match-end 0)) :end) (t (error "Cannot decode object: %d" (point))))
  nrepl-bdecode-buffer()
  (cons (nrepl-bdecode-buffer) result)
  (setq result (cons (nrepl-bdecode-buffer) result))
  (while (not (eobp)) (setq result (cons (nrepl-bdecode-buffer) result)))
  (let ((result (quote nil))) (while (not (eobp)) (setq result (cons (nrepl-bdecode-buffer) result))) (nreverse result))
  (progn (save-excursion (insert str)) (let ((result (quote nil))) (while (not (eobp)) (setq result (cons (nrepl-bdecode-buffer) result))) (nreverse result)))
  (unwind-protect (progn (save-excursion (insert str)) (let ((result (quote nil))) (while (not (eobp)) (setq result (cons (nrepl-bdecode-buffer) result))) (nreverse result))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (save-excursion (insert str)) (let ((result (quote nil))) (while (not (eobp)) (setq result (cons (nrepl-bdecode-buffer) result))) (nreverse result))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (save-excursion (insert str)) (let ((result (quote nil))) (while (not (eobp)) (setq result (cons ... result))) (nreverse result))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  nrepl-decode("d5:class39:clojure.lang.Compiler$CompilerException2:id2:147:message178:java.lang.RuntimeException: Unable to resolve symbol: docker-exec in this context, compiling:(/Users/duncan/projects/palletops/docker-exec/src/pallet/docker/file_upload.clj:18:3)7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad0ed5:class26:java.lang.RuntimeException2:id2:147:message53:Unable to resolve symbol: docker-exec in this context7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad0ed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6464e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl3:dup4:javae2:id2:144:linei6406e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class32:clojure.lang.Compiler$InvokeExpr4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei3665e6:method5:parse4:name38:clojure.lang.Compiler$InvokeExpr/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6646e6:method10:analyzeSeq4:name32:clojure.lang.Compiler/analyzeSeq7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6445e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl3:dup4:javae2:id2:144:linei6406e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class37:clojure.lang.Compiler$BodyExpr$Parser4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei5782e6:method5:parse4:name43:clojure.lang.Compiler$BodyExpr$Parser/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class30:clojure.lang.Compiler$FnMethod4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei5217e6:method5:parse4:name36:clojure.lang.Compiler$FnMethod/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class28:clojure.lang.Compiler$FnExpr4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei3846e6:method5:parse4:name34:clojure.lang.Compiler$FnExpr/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6642e6:method10:analyzeSeq4:name32:clojure.lang.Compiler/analyzeSeq7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6445e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6632e6:method10:analyzeSeq4:name32:clojure.lang.Compiler/analyzeSeq7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6445e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei38e6:method10:access$1004:name32:clojure.lang.Compiler/access$1007:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class36:clojure.lang.Compiler$DefExpr$Parser4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei538e6:method5:parse4:name42:clojure.lang.Compiler$DefExpr$Parser/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6644e6:method10:analyzeSeq4:name32:clojure.lang.Compiler/analyzeSeq7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6445e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:cloju")
  (prog1 (nrepl-decode data) (delete-region start end))
  (let* ((start (point-min)) (end (point-max)) (data (buffer-substring start end))) (prog1 (nrepl-decode data) (delete-region start end)))
  nrepl-net-decode()
  (let ((responses (nrepl-net-decode))) (let ((--dolist-tail-- responses)) (while --dolist-tail-- (let ((response (car --dolist-tail--))) (nrepl-dispatch response) (setq --dolist-tail-- (cdr --dolist-tail--))))))
  (while (> (buffer-size) 1) (let ((responses (nrepl-net-decode))) (let ((--dolist-tail-- responses)) (while --dolist-tail-- (let ((response (car --dolist-tail--))) (nrepl-dispatch response) (setq --dolist-tail-- (cdr --dolist-tail--)))))))
  (condition-case err (while (> (buffer-size) 1) (let ((responses (nrepl-net-decode))) (let ((--dolist-tail-- responses)) (while --dolist-tail-- (let ((response ...)) (nrepl-dispatch response) (setq --dolist-tail-- (cdr --dolist-tail--))))))) ((debug error) (message "Error: %S" err) nil))
  (let ((nrepl-connection-dispatch (current-buffer))) (condition-case err (while (> (buffer-size) 1) (let ((responses (nrepl-net-decode))) (let ((--dolist-tail-- responses)) (while --dolist-tail-- (let (...) (nrepl-dispatch response) (setq --dolist-tail-- ...)))))) ((debug error) (message "Error: %S" err) nil)))
  (save-current-buffer (set-buffer (process-buffer process)) (let ((nrepl-connection-dispatch (current-buffer))) (condition-case err (while (> (buffer-size) 1) (let ((responses (nrepl-net-decode))) (let ((--dolist-tail-- responses)) (while --dolist-tail-- (let ... ... ...))))) ((debug error) (message "Error: %S" err) nil))))
  nrepl-net-process-input(#<process nrepl>)
  nrepl-net-filter(#<process nrepl> "d5:class39:clojure.lang.Compiler$CompilerException2:id2:147:message178:java.lang.RuntimeException: Unable to resolve symbol: docker-exec in this context, compiling:(/Users/duncan/projects/palletops/docker-exec/src/pallet/docker/file_upload.clj:18:3)7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad0ed5:class26:java.lang.RuntimeException2:id2:147:message53:Unable to resolve symbol: docker-exec in this context7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad0ed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6464e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl3:dup4:javae2:id2:144:linei6406e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class32:clojure.lang.Compiler$InvokeExpr4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei3665e6:method5:parse4:name38:clojure.lang.Compiler$InvokeExpr/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6646e6:method10:analyzeSeq4:name32:clojure.lang.Compiler/analyzeSeq7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6445e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl3:dup4:javae2:id2:144:linei6406e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class37:clojure.lang.Compiler$BodyExpr$Parser4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei5782e6:method5:parse4:name43:clojure.lang.Compiler$BodyExpr$Parser/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class30:clojure.lang.Compiler$FnMethod4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei5217e6:method5:parse4:name36:clojure.lang.Compiler$FnMethod/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class28:clojure.lang.Compiler$FnExpr4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei3846e6:method5:parse4:name34:clojure.lang.Compiler$FnExpr/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6642e6:method10:analyzeSeq4:name32:clojure.lang.Compiler/analyzeSeq7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6445e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6632e6:method10:analyzeSeq4:name32:clojure.lang.Compiler/analyzeSeq7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6445e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei38e6:method10:access$1004:name32:clojure.lang.Compiler/access$1007:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class36:clojure.lang.Compiler$DefExpr$Parser4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei538e6:method5:parse4:name42:clojure.lang.Compiler$DefExpr$Parser/parse7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6644e6:method10:analyzeSeq4:name32:clojure.lang.Compiler/analyzeSeq7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:clojure.lang.Compiler4:file13:Compiler.java5:flagsl4:javae2:id2:144:linei6445e6:method7:analyze4:name29:clojure.lang.Compiler/analyze7:session36:bc0f57ac-787f-404c-9f89-8512ad3d1ad04:type4:javaed5:class21:cloju")

After evaluating cider-stacktrace.el, evaluating a clojure expression that throws an exception gives this in *messages*, but still displays the clojure exception correctly:

Error: (wrong-type-argument integer-or-marker-p nil) [2 times]
@cichli
Copy link
Member

cichli commented May 28, 2014

I've also been having the same issue (for a while now). If I remove all Cask dependencies and .emacs.d configuration except that which pertains to CIDER, then stacktraces render fine without manually evaluating the file. Unfortunately I've been having a lot of trouble tracking down the exact culprit that's causing the conflict, but I'll take another look this evening.

@omnicognate
Copy link

Not sure if it's the same thing, but I can't run a test until I evaluate cider-stacktrace.el manually and restart cider. If I don't do this, C-c, C-, gives me "Can't find nREPL middleware providing op stacktrace. Please, install cider-nrepl and restart CIDER".

Maybe related, maybe not - I always get the following message on cider-jack-in: "Cannot decode message: ; CIDER 0.7.0alpha (package: 20140602.500) (Java 1.6.0_29, Clojure 1.5.1, nREPL 0.2.3)".

@bbatsov
Copy link
Member

bbatsov commented Jun 3, 2014

@jeffvalk Could you have a look at this problem? Perhaps some autoload issue or something similar?

@jeffvalk
Copy link
Contributor

jeffvalk commented Jun 3, 2014

I haven't been able to reproduce the stacktrace not showing up. If anyone has a minimal test case, that would be helpful.

@bbatsov What I am seeing, though, is a consistent parade of nrepl-decode errors. The wrong-type-argument integer-or-marker-p nil is thrown there. I'll take a deeper look in a bit.

@cichli
Copy link
Member

cichli commented Jun 3, 2014

The issue seems to be with installing clojure-test-mode before CIDER. If I run emacs -q and evaluate the following, then errors thrown in the REPL have an empty *cider-error*. Switching the order of the installs fixes the issue.

(require 'package)
(add-to-list 'package-archives
  '("melpa" . "http://melpa.milkbox.net/packages/") t)

(package-initialize)
(package-refresh-contents)

(package-install 'clojure-test-mode)
(package-install 'cider)

(setq cider-repl-popup-stacktraces t)
(cider-jack-in)

@jeffvalk
Copy link
Contributor

jeffvalk commented Jun 3, 2014

I haven't looked at this in depth yet, but something else is at play. I uninstalled clojure-test-mode, and disabled cider-stacktrace, and I still get wrong-type-argument integer-or-marker-p nil from nrepl-decode when I start a REPL.

@jeffvalk
Copy link
Contributor

jeffvalk commented Jun 3, 2014

Isn't this the same issue as #597?

@hugoduncan
Copy link
Member Author

This seems to have resolved itself for me on the last few cider updates. The first exception doesn't get displayed, but subsequent ones do.

vspinu added a commit to vspinu/cider that referenced this issue Jun 11, 2014
vspinu added a commit to vspinu/cider that referenced this issue Jun 11, 2014
vspinu added a commit to vspinu/cider that referenced this issue Jun 11, 2014
vspinu added a commit to vspinu/cider that referenced this issue Jun 11, 2014
vspinu added a commit to vspinu/cider that referenced this issue Jun 11, 2014
vspinu added a commit to vspinu/cider that referenced this issue Jun 11, 2014
@bbatsov bbatsov closed this as completed Jun 11, 2014
dgtized pushed a commit to dgtized/cider that referenced this issue Jun 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants