-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Constantly growing backlog of nrepl-pending-requests
#3206
Comments
The purpose of this variable was to keep track of evaluations that might still be producing some output even after they returned some result. Basically there was this problem that there evaluation handler would disappear and this would result in mistakes. I always knew this was an ugly hack and I recall I planned to replace it with some fallback handler, but I don't remember if I ever did it or not. A lot time ago I planned to rewrite the whole evaluation logic and I expected this was going to go away in the improved version, sadly I never got to doing this. That's one of the tickets related to this for context #1099 |
I reckon that a given request is good to clear if one of its responses has returned a |
@vemv You can have an eval return |
(Thanks!) A complementary strategy could be to use The subset of ops that can eval (and therefore keep producing output) is fairly well-known. We also can reason about the cider-nrepl ops that are not expected to eval code or emit unexpected output. For those, we can dissoc them on |
@bbatsov could nREPL ops describe themselves with extra metadata? e.g. they could return |
I think list tracks only |
(I agreed to suppress the error with the broken REPL history simply because this was breaking the REPL init process, which I consider a special case) |
From a quick observation, it tracks a bit of everything. Technically, a variety of ops can eval, e.g. |
Ah, yeah - I had forgotten about |
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.
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
The text was updated successfully, but these errors were encountered: