Expected behavior
I'm not sure what this variable is meant to be, but it shouldn't be constantly growing in size and taking up memory.
Actual behavior
The buffer-local hashtable variable nrepl-pending-requests in the cider REPL buffer gets filled up with entries that never get cleared. Over the course of a long running session (multiple weeks) I saw it grow to tens of thousands of entries, which affected performance and crashed Emacs when I attempted to print it out.
Steps to reproduce the problem
Jack in to an empty repro project, and cider-load-buffer a few times on the following file, triggering errors and the cider stacktrace buffer to pop up.
M-x cider-switch-to-repl-buffer
M-x describe-variable -> nrepl-pending-requests
Observe that the variable has accumulated entries for each time an error was produced.
#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data
("6" cider--debug-response-handler "10"
#[257 "�\205��\301\302!\207"
[cljr--debug-mode message "Artifact cache updated"]
3 "\n\n(fn _)"]
"16"
(closure
((causes . t)
cider-required-middleware-version t)
(response)
(setq causes
(cider--handle-stacktrace-response response causes)))
"30"
(closure
((causes . t)
cider-required-middleware-version t)
(response)
(setq causes
(cider--handle-stacktrace-response response causes)))
"32"
(closure
((causes . t)
cider-required-middleware-version t)
(response)
(setq causes
(cider--handle-stacktrace-response response causes)))))
This is not restricted to stacktrace errors, which I've just chosen as the easiest way to trigger the issue.
Over time, this hashtable will be filled with all sorts of entries, eg. what appear to be completion requests and cider-eldoc messages, among other things.
I do not know the purpose or context behind the existence of this variable, but this comment suggests that there was a plan for its removal:
|
;; FIXME: This should go away eventually when we get rid of |
Environment & Version information
CIDER version information
;; CIDER 1.4.0 (Kyiv), nREPL 0.9.0
;; Clojure 1.10.1, Java 18.0.1
Lein / Clojure CLI version
Clojure CLI version 1.11.1.1113
Emacs version
28.0.91
Operating system
macOS 12
JDK distribution
openjdk version "13.0.2" 2020-01-14
Expected behavior
I'm not sure what this variable is meant to be, but it shouldn't be constantly growing in size and taking up memory.
Actual behavior
The buffer-local hashtable variable
nrepl-pending-requestsin the cider REPL buffer gets filled up with entries that never get cleared. Over the course of a long running session (multiple weeks) I saw it grow to tens of thousands of entries, which affected performance and crashed Emacs when I attempted to print it out.Steps to reproduce the problem
Jack in to an empty repro project, and
cider-load-buffera few times on the following file, triggering errors and the cider stacktrace buffer to pop up.M-x cider-switch-to-repl-bufferM-x describe-variable->nrepl-pending-requestsObserve that the variable has accumulated entries for each time an error was produced.
This is not restricted to stacktrace errors, which I've just chosen as the easiest way to trigger the issue.
Over time, this hashtable will be filled with all sorts of entries, eg. what appear to be completion requests and cider-eldoc messages, among other things.
I do not know the purpose or context behind the existence of this variable, but this comment suggests that there was a plan for its removal:
cider/nrepl-client.el
Line 737 in e86f2f7
Environment & Version information
CIDER version information
Lein / Clojure CLI version
Clojure CLI version 1.11.1.1113
Emacs version
28.0.91
Operating system
macOS 12
JDK distribution
openjdk version "13.0.2" 2020-01-14