Fork me on GitHub
#cider
<
2021-06-26
>
timvisher16:06:27

👋 I'm seeing an issue when passing nil to < where the printer seems to get caught throwing an NPE and losing any useful stack trace (see the brief discussion starting https://clojurians.slack.com/archives/C03S1KBA2/p1624725785482400). In summary: Evaling

(doall (map (partial < 1000) (conj (into [] (range 1000 1002)) nil)))
at a plain REPL gets me
user=>
(doall (map (partial < 1) [1 2 nil]))
Execution error (NullPointerException) at user/eval158 (REPL:1).
null
(note the user/eval158 bit which I think indicates the actual source of the error information) whereas in CIDER (`CIDER 1.1.1 (Plovdiv)`) whacking M-x cider-eval-last-sexp RET yields
1. Unhandled java.lang.NullPointerException
   (No message)
with the following messages in *Messages*
error in process filter: cider-stacktrace-render-frame: Format specifier doesn’t match argument type
error in process filter: Format specifier doesn’t match argument type
Does this sound like a bug to anyone else? I'm happy to open an Issue if it does.

timvisher17:06:30

Actually a much shorter reproduction case is just

(< 1 nil)

dpsutton17:06:58

That’s a bug in elisp I think. It’s in the buffer trying to render the frame

timvisher17:06:33

I'd buy that. :)

dpsutton17:06:54

The error message you are posting there is an emacs logged message, not from clojure

timvisher17:06:15

You mean from *Messages*?

dpsutton17:06:32

There’s a jvm argument to not omit stacktraces on npe. Wondering if you could add that and see

timvisher17:06:58

I'm more than happy to add JVM arguments. :)

timvisher17:06:16

Need to look up how to do that in deps.edn. I'm just in a simple one file project with a deps.edn file and cider jack in.

timvisher17:06:45

Looks like :jvm-opts in the map.

timvisher17:06:04

@dpsutton Do you happen to know the option off the top of your head?

timvisher17:06:47

Looks like maybe -XX:-OmitStackTraceInFastThrow

dpsutton17:06:36

Yeah I think so

timvisher17:06:25

That did it.

timvisher17:06:57

Well actually this is interesting. I guess the JVM is doing some kind of syslog style exception compression since after a couple of evals I get back to getting No message. There's gotta be an option that disables that feature altogether.

timvisher17:06:54

Actually it sounds like maybe I'm just straight up not passing the option down to the JVM.

timvisher17:06:31

I certainly don't see it on the CL as per pgrep -fla java.

timvisher17:06:23

Yep. I need to make an aliases map.

timvisher17:06:23

LOL. This feels slightly less than fully documented…

timvisher17:06:38

OOOOK finally got it.

$ cat deps.edn
{:deps
 …
 :aliases {:dev {:jvm-opts ["-XX:-OmitStackTraceInFastThrow"]}}}
Followed by M-0 M-x cider-jack-in RET and appending :dev to the CL like
jack-in command: /usr/local/bin/clojure … -M:cider/nrepl:dev
` finally yields the option in pgrep
$ pgrep -fla java
99854 /usr/bin/java -XX:-OmitStackTraceInFastThrow …
and gets me the full stack trace every time I trigger the exception. Whooooo boy that's fun.

dpsutton17:06:49

Ok so that’s an issue to open. Cider barfs on errors where the stack trace is omitted

❤️ 3