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

Problematic error reporting when cider-clojure-compilation-error-phases is t (unexpected possible value) #3582

Closed
zikajk opened this issue Nov 13, 2023 · 7 comments

Comments

@zikajk
Copy link

zikajk commented Nov 13, 2023

Expected behavior

Same as older version of Cider, probably before cider-clojure-compilation-error-phases was introduced.

Actual behavior

When evaluating sexp or buffer with enabled cider-clojure-compilation-error-phases I get an exception

Debugger entered--Lisp error: (wrong-type-argument listp t)
  cider--handle-stacktrace-response((dict "id" "18" "session" "051e38ac-65e6-495f-9101-e1..." "status" ("done")) ((dict "class" "java.lang.RuntimeException" "compile-like" "false" "id" "18" "message" "Unable to resolve symbol: ..." "phase" nil "session" "051e38ac-65e6-495f-9101-e1..." "stacktrace" (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...)) (dict "class" "clojure.lang.Compiler$Comp..." "column" 1 "compile-like" "false" "data" "#:clojure.error{:phase :co..." "file" "/Users/akiz/Code/Clojure/d..." "file-url" "file:/Users/akiz/Code/Cloj..." "id" "18" "line" 8 "location" (dict "clojure.error/column" 1 "clojure.error/line" 8 "clojure.error/phase" "compile-syntax-check" "clojure.error/source" "/Users/akiz/Code/Clojure/d...") "message" "Syntax error compiling at ..." "path" "src/deleteme/core.clj" "phase" "compile-syntax-check" "session" ...)) "compile-syntax-check")
  #f(compiled-function (response) #<bytecode 0x166c3faa4716d242>)((dict "id" "18" "session" "051e38ac-65e6-495f-9101-e1b232f70ee6" "status" ("done")))
  nrepl--dispatch-response((dict "id" "18" "session" "051e38ac-65e6-495f-9101-e1b232f70ee6" "status" ("done")))
  nrepl-client-filter(#<process nrepl-connection> "tible_eval$evaluate4:file22:interruptible_eval.clj...")
  nrepl-send-sync-request(("op" "analyze-last-stacktrace" "nrepl.middleware.print/stream?" "1" "nrepl.middleware.print/print" "cider.nrepl.pprint/pprint" "nrepl.middleware.print/quota" 1048576 "nrepl.middleware.print/buffer-size" 4096 "nrepl.middleware.print/options" (dict "right-margin" 70)) #<buffer *cider-repl Clojure/deleteme:localhost:64281(clj)*>)
  cider--error-phase-of-last-exception(#<buffer core.clj>)
  #f(compiled-function (buffer err) #<bytecode 0xd9568613f25944b>)(#<buffer core.clj> "Syntax error compiling at (src/deleteme/core.clj:8...")
  #f(compiled-function (response) #<bytecode 0x63342be919beaaf>)((dict "err" "Syntax error compiling at (src/deleteme/core.clj:8..." "id" "16" "session" "051e38ac-65e6-495f-9101-e1b232f70ee6"))
  nrepl--dispatch-response((dict "err" "Syntax error compiling at (src/deleteme/core.clj:8..." "id" "16" "session" "051e38ac-65e6-495f-9101-e1b232f70ee6"))
  nrepl-client-filter(#<process nrepl-connection> "d3:err102:Syntax error compiling at (src/deleteme/...")


Sometimes (I guess it depends on buffer / function size) it takes a very long time and I get a timeout =>
error in process filter: Sync nREPL request timed out (op analyze-last-stacktrace nrepl.middleware.print/stream? 1 nrepl.middleware.print/print cider.nrepl.pprint/porint nrepl.middleware.print/auota 1048576 nrepl.middleware.print/buffer-size 4996 ….) after 30 secs
In those cases, the overlay error sometimes shows up but it dissapears again after +-1sec.

Steps to reproduce the problem

  1. lein new something
  2. Open emacs, run toggle-debug-on-error, open project and start jack-in new repl.
  3. write (defz) and evaluate a buffer

Environment & Version information

CIDER version information

  • ;; Startup: bash /Users/akiz/.emacs.akiz/straight/build/cider/lein.sh /opt/homebrew/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"1.0.0\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.9.0\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.9.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.43.3\"\] -- update-in :plugins conj \[mx.cider/lein-enrich-classpath\ \"1.18.4\"\] -- update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware -- repl :headless :host localhost
;; CIDER 1.12.0-snapshot (package: 1.12.0-snapshot), nREPL 1.0.0
;; Clojure 1.11.1, Java 17.0.8.1

Lein / Clojure CLI version

Leiningen 2.10.0 on Java 17.0.8.1 OpenJDK 64-Bit Server VM

Emacs version

  • Gcemacs 29.1

Operating system

OSX Sonoma 14.0

JDK distribution

openjdk version "17.0.8.1" 2023-08-24
OpenJDK Runtime Environment Homebrew (build 17.0.8.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.8.1+0, mixed mode, sharing)

@vemv
Copy link
Member

vemv commented Nov 13, 2023

What's your cider-clojure-compilation-error-phases value?

Perhaps you changed it to t? It's either list or nil

@zikajk
Copy link
Author

zikajk commented Nov 13, 2023

I see, I did. What is the default value?
Nevermind: This issue was really caused just by wrong configuration, thank you!

@vemv
Copy link
Member

vemv commented Nov 13, 2023

cider/cider-eval.el

Lines 489 to 497 in a35170b

(defcustom cider-clojure-compilation-error-phases '("read-source"
"macro-syntax-check"
"macroexpansion"
"compile-syntax-check"
"compilation"
;; "execution" is certainly not to be included here.
;; "read-eval-result" and "print-eval-result" are not to be included here,
;; because they mean that the code has been successfully executed.
)

You also can simply remove it from the customized vars.

Let's keep the issue open - we have other variables where t means "the default list" so this would be a nice improvement.

@zikajk
Copy link
Author

zikajk commented Nov 13, 2023

  1. Now I tried a really big project, I got this.
    image

Maybe I found the root of the issue!
I tried it twice for each case. When I remove Flowstorm's Clojure, I don't get this error.
When I add it, i get the error again.

This is relevant part of my project.clj

-  :dependencies [[org.clojure/clojure "1.11.1"]
+  :dependencies [#_[org.clojure/clojure "1.11.1"]
....
                    :jvm-opts ["-Djdk.attach.allowAttachSelf"
+                              "-XX:+UnlockDiagnosticVMOptions" "-XX:+DebugNonSafepoints" "-XX:-OmitStackTraceInFastThrow"
+                              "-Dflowstorm.startRecording=false"
+                              "-Dclojure.storm.instrumentEnable=true"
+                              "-Dclojure.storm.instrumentOnlyPrefixes=backend.,systems."]
+                   :exclusions [org.clojure/clojure]
                    :dependencies [[integrant/repl "0.3.2"]
+                                  [com.github.jpmonettas/clojure "1.12.0-master-SNAPSHOT"]

@vemv
Copy link
Member

vemv commented Nov 13, 2023

That would make sense as an explanation for the overall slowness that you have been experiencing (as shared over Slack).

I'll ask around in #flow-storm for understanding how to proceed.

@zikajk
Copy link
Author

zikajk commented Nov 13, 2023

That would make sense as an explanation for the overall slowness that you have been experiencing (as shared over Slack).

I'll ask around in #flow-storm for understanding how to proceed.

Thank you.
It didn't occur to me to suspect flow-storm, because I figured jpmonettas would have noticed the same thing. On the other hand - OS and configuration can play a role.

@vemv
Copy link
Member

vemv commented Nov 13, 2023

To be clear, what is the custom clojure causing?

  • The opaque Error in thread Thread
  • Any slowness
  • Both?

@vemv vemv changed the title Problematic error reporting when cider-clojure-compilation-error-phases is enabled Problematic error reporting when cider-clojure-compilation-error-phases is t (unexpected possible value) Nov 13, 2023
@vemv vemv closed this as completed in 5261886 Nov 14, 2023
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

2 participants