cider icon indicating copy to clipboard operation
cider copied to clipboard

CIDER nREPL Times Out on Long Evaluation

Open steele232 opened this issue 7 years ago • 5 comments

I searched for "long evaluation" in the issues search bar and didn't find any results, so thought this issue would not be a repeat.

Expected behavior

I am running a hefty function in an Org mode code block. I would like it to run for a couple minutes and then return the result.

I'm hoping that there is a way to set the timeout on the REPL connection to be a longer time; that seems like the easiest solution but I don't know how to do it. If that is not possible, maybe some one can create this sort of feature and make it work for my use case.

Actual behavior

Instead, it waits 5 seconds and then says that the REPL is responsive. The error is:

"Sync nREPL request timed out (op eval code (ns user)"

Steps to reproduce the problem

Execute this source block (it's not my real code, I just made this line of code up to make it easier to reproduce the problem); it takes about 9 seconds on my terminal lein repl but times out on the CIDER connection.

#+BEGIN_SRC clojure
  (for [x (range 0 10000000 0.5)] x)
#+END_SRC

Environment & Version information

CIDER version information

When I run cider-jack-in, this is the version I see:

[nREPL] Starting server via /usr/local/bin/clojure -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} refactor-nrepl {:mvn/version "2.4.0"} cider/cider-nrepl {:mvn/version "0.21.2-SNAPSHOT"}}}' -m nrepl.cmdlin --middleware '["cider.nrepl/cider-middleware"]'...

Lein/Boot version

The above seems to say that CIDER is using clojure, not Lein, but I'm not sure...

Leiningen 2.8.3 on Java 1.8.0_191 Java HotSpot(TM) 64-Bit Server VM
REPL-y 0.4.3, nREPL 0.5.3
Clojure 1.8.0

Emacs version

GNU Emacs 26.1 (build 1, x86_64-apple-darwin18.0.0, NS appkit-1671.00 Version 10.14 (Build 18A391)) of 2018-10-04

Operating system

OS X 10.14 "Mojave"

steele232 avatar Mar 28 '19 03:03 steele232

See this:

(defcustom nrepl-sync-request-timeout 10
  "The number of seconds to wait for a sync response.
Setting this to nil disables the timeout functionality."
  :type 'integer
  :group 'nrepl)

bbatsov avatar Mar 28 '19 08:03 bbatsov

On a general note - sync evals were not meant to be used in the context org seems to use them, so someone should probably update it to use async requests.

bbatsov avatar Mar 28 '19 08:03 bbatsov

I guess we can close this one.

bbatsov avatar Apr 01 '19 18:04 bbatsov

Apologies for the necrobump, I might be misunderstanding the linked variable:

with (setq nrepl-sync-request-timeout 1)

and then evaling (Thread/sleep 5000), I hang for 5 seconds, instead of the expected 1

neeasade avatar Sep 19 '22 22:09 neeasade

@neeasade Likely you did some async evaluation command (pretty much all user commands are async, the sync eval is just for internal purposes of CIDER - e.g. things like code completion).

bbatsov avatar Sep 20 '22 05:09 bbatsov