clojure-emacs/cider

`cider--error-phase-of-last-exception` can call itself when the cider-nrepl middleware is faulty

Closed this issue · 3 comments

vemv commented

One thing I've noticed with recent reports is that whenever the cider-nrepl analyze-stacktrace op was faulty, cider--error-phase-of-last-exception would enter into a recursion loop.

Worth investigating

whenever the cider-nrepl analyze-stacktrace op was faulty

Faulty how?

vemv commented

For instance:

  • Running an older Clojure
  • Having 1M files in resources

(both cases are fixed by now)

Those two are unrelated but resulted in the same symptoms.

vemv commented

Can repro by:

  • Entering (/ 2 0) in the repl
    • Doesn't trigger the issue - it merely ensures that the mw is loaded.
  • modifying cider.nrepl.middleware.stacktrace/analyze-last-stacktrace to throw an exception like (/ 2 0)
  • evaling an expr, but not from the repl, but inline in a .clj buffer instead (cider-eval-sexp-at-point)

So this should be specific to its eval handler (there are a few eval handlers that call cider--error-phase-of-last-exception), namely cider-interactive-eval-handler.

This creates a loop that C-g can't exit, presumably because requests will keep happening.