3

My clojure repl started throwing a "Variable binding depth exceeds max-specpdl-size" error and I've gotten thrown into the debugger.

I am currently accessing slime via clojure-jack-in and I am executing a reduce on a reasonable sized dataset. A bit of googling leads me to believe that the error is because I'm generating too many temporary variables, specifically:

User Option: max-specpdl-size

This variable defines the limit on the total number of local variable bindings and unwind-protect cleanups (see Cleaning Up from Nonlocal Exits) that are allowed before Emacs signals an error (with data "Variable binding depth exceeds max-specpdl-size").

This limit, with the associated error when it is exceeded, is one way that Lisp avoids infinite recursion on an ill-defined function. max-lisp-eval-depth provides another limit on depth of nesting. See Eval.

The default value is 1000. Entry to the Lisp debugger increases the value, if there is little room left, to make sure the debugger itself has room to execute. found here.

I have little experience with debugging clojure-swank/slime so I hope someone can help.

EDIT: I'm using clojure-mode 1.11.4 with emacs 24 and clojure 1.3.0, I've not installed swank-clojure, I'm using the one that comes bundled with clojure-mode via clojure-jack-in as I explained earlier.

astine
  • 276
  • 2
  • 9
toofarsideways
  • 3,956
  • 2
  • 31
  • 51
  • I would expect there is a problem somewhere parsing the output of your REPL statement. What versions of clojure-mode, swank-clojure, emacs, clojure are you using - are you up to date on all of them? Can you reproduce the problem reliably on the SLIME REPL? What's the clojure expression you're trying to evaluate? – Joost Diepenmaat Dec 14 '11 at 08:42
  • What version of swank-clojure is this with? I know you say you haven't installed it, but you must have on the lein side of things for clojure-jack-in to work. – Tavis Rudd Jan 28 '12 at 17:20
  • With regards to the plugins I'm using I'm not sure how to get swank to say which version it is, I have `swank-clojure` `1.3.2` and `1.3.3-SNAPSHOT` both installed. – toofarsideways Jan 28 '12 at 19:47
  • Typing random, syntactically incorrect characters triggers this error on my machine. So deleting spurious tokens (if any) may solve the issue. – deprecated Apr 04 '12 at 23:22

1 Answers1

0

Just in case someone is looking for a possible answer to this questions....

This error, as outlined, does often mean a problem, but not always. You can legitimately exceed the default depth setting in situations where you have large data structures or where you are usiing some emacs features, such as defadvice, which can result in deep bindings etc. You can increase the depth and see if that helps (for example, double it), but in this case it probably is an error.

One of the problems with swank-clojure is that it is tightly coupled with an old version of slime. This means improvements and bug fixes in slime are not available. It is because of this tight binding that the coljure community has moved away from using slime to using cider and I'd strongly recommend switching to using cider rather than slime and swank-clojure.

Tim X
  • 4,158
  • 1
  • 20
  • 26