Skip to content
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

cider-connect fails on first try #671

Closed
julienfantin opened this issue Jul 22, 2014 · 33 comments
Closed

cider-connect fails on first try #671

julienfantin opened this issue Jul 22, 2014 · 33 comments

Comments

@julienfantin
Copy link

I've had this issue for a while, where the first cider-connect invocation always hangs for a while and eventually errors with error in process filter: Quit, but the next invocation goes through.

CIDER 0.7.0snapshot (package: 20140721.1252) (Java 1.7.0_60, Clojure 1.6.0, nREPL 0.2.3, cider-nrepl 0.7.0-snapshot)
GNU Emacs 24.4.50.1 (x86_64-apple-darwin14.0.0, NS appkit-1326.11 Version 10.10 (Build 14A298i))
@bbatsov
Copy link
Member

bbatsov commented Jul 23, 2014

I'll need some reliable steps to reproduce this so I can debug and fix it. Tried a few projects, all seem to work ok.

@scottdw
Copy link
Contributor

scottdw commented Aug 6, 2014

I see this fairly regularly as well but cannot reproduce reliably. General steps:

  1. Open project.clj
  2. cider-jack-in

In the *Messages* buffer:

Starting nREPL server via lein repl :headless...
nREPL server started on 59399
Connecting to nREPL server on localhost:59399...
error in process filter: Quit [2 times]

An empty *cider-repl <project-name>* is created and switched to. A *nrepl-server <project-name>* is created and logged to as usual including the usual last entry:

nREPL server started on port 59399 on host 127.0.0.1 - nrepl://127.0.0.1:59399

Running cider-connect using the default parameters connects to the nrepl server as expected creating a new *cider-repl 127.0.0.1* buffer which be used as normal.

Off the top of my head I would guess it has something to do with a timeout waiting for the lein process.

@laczoka
Copy link

laczoka commented Aug 10, 2014

+1,

although adding the following lines to my (otherwise empty) company-mode config made the issue disappear completely:

(setq company-idle-delay 0.5)
(setq company-tooltip-limit 10)
(setq company-minimum-prefix-length 2)
(setq company-tooltip-flip-when-above t)

(courtesy of bbatsov)

I was using the following empty project (/w cider-nrepl 0.7.0):

(ns embnrepl.core
(:require [clojure.tools.nrepl.server :as nrepl-server]
[cider.nrepl :refer (cider-nrepl-handler)]))

(defn -main
[](nrepl-server/start-server :port 7888 :handler cider-nrepl-handler)
(println "nRepl server started"))

Without having these line, I could reproduce the issue the issue in two ways:

  • lein run
  • start Emacs
  • cider-connect to the nrepl server
    The first time it gives me an error, on any subsequent attempt, it works fine, _even if I restart Emacs_!!

Or if I keep Emacs running, and restart the nrepl server it still works.

otfrom added a commit to otfrom/otfrom-org-emacs that referenced this issue Aug 10, 2014
@bbatsov
Copy link
Member

bbatsov commented Aug 11, 2014

@dgutov Any ideas which of company's defaults might be causing this (I'm guessing the idle delay)? I guess the problem is that it tries to fetch completions before cider has finished connecting to the nREPL server.

@dgutov
Copy link
Contributor

dgutov commented Aug 11, 2014

(I'm guessing the idle delay)?

Most likely. The other options don't seem relevant.

I don't think raising its value would be a good solution, though: the nrepl server might take even more time to start on slower machines.

@laczoka
Copy link

laczoka commented Aug 11, 2014

Is there a some lazy initialisation step in starting nrepl-server or
cider-nrepl? It only ever occurs for the very first time I try to connect
to it.

2014-08-11 11:38 GMT+01:00 Dmitry Gutov [email protected]:

(I'm guessing the idle delay)?

Most likely. The other options don't seem relevant.

I don't think raising its value would be a good solution, though: the
nrepl server might take even more time to start on slower machines.


Reply to this email directly or view it on GitHub
#671 (comment).

László Török
Checkout Lollyrewards.com http://www.lollyrewards.com - Giving credit,
getting credit.
Follow us on Twitter @lollyrewards https://twitter.com/lollyrewards
Stay up to date on the latest offers by liking our Facebook page
https://www.facebook.com/lollyrewards.

@dgutov
Copy link
Contributor

dgutov commented Aug 11, 2014

I guess the problem is that it tries to fetch completions

Although, why would it try to fetch completions? cider-jack-in is probably not in company-begin-commands.

@bbatsov
Copy link
Member

bbatsov commented Aug 11, 2014

No idea. I was pretty surprised when @laczoka suggested that company was causing this particular problem (although I'm still not convinced this is the case).

@dgutov
Copy link
Contributor

dgutov commented Aug 11, 2014

If the command works asynchronously (or if there's some asynchronous element to its completion after the function returns), maybe the user starts typing something, then company-idle-delay passes but the nrepl launch is still not finished, and that might cause the problem, I guess.

@bbatsov
Copy link
Member

bbatsov commented Aug 11, 2014

I've added a simple connection check to the completion-at-point function. Let's see if this will solve the problem.

@laczoka
Copy link

laczoka commented Aug 11, 2014

Hi,

just wanted to add, the I'm unconvinced myself! It looks like a sporadic
issue and the high number of variable factors between emacs configs,
hardware etc. makes it difficult for me to isolate the issue. My elisp-fu
debugging skills are close to zero, unfortunately.

2014-08-11 12:38 GMT+01:00 Bozhidar Batsov [email protected]:

No idea. I was pretty surprised when @laczoka https://github.com/laczoka
suggested that company was causing this particular problem (although I'm
still not convinced this is the case).


Reply to this email directly or view it on GitHub
#671 (comment).

László Török
Checkout Lollyrewards.com http://www.lollyrewards.com - Giving credit,
getting credit.
Follow us on Twitter @lollyrewards https://twitter.com/lollyrewards
Stay up to date on the latest offers by liking our Facebook page
https://www.facebook.com/lollyrewards.

@jeffvalk
Copy link
Contributor

I've seen this issue too, and I'm using auto-complete, not company.

@laczoka
Copy link

laczoka commented Aug 11, 2014

I've played with this a bit more, I am almost certain now, that the company
settings are irrelevant.

I can't really tell since, not exactly sure, what the error message means
and/or how to capture a stacktrace.

Pointers are welcome :)

2014-08-11 19:56 GMT+01:00 Jeff Valk [email protected]:

I've seen this issue too, and I'm using auto-complete, not company.


Reply to this email directly or view it on GitHub
#671 (comment).

László Török
Checkout Lollyrewards.com http://www.lollyrewards.com - Giving credit,
getting credit.
Follow us on Twitter @lollyrewards https://twitter.com/lollyrewards
Stay up to date on the latest offers by liking our Facebook page
https://www.facebook.com/lollyrewards.

@scottdw
Copy link
Contributor

scottdw commented Aug 11, 2014

I haven't had a chance to try debug this myself but try M-x toggle-debug-on-error and trigger the error which should pop you into the elisp debugger and where you can get a stacktrace if an elisp error is actually thrown. See [http://www.gnu.org/software/emacs/manual/html_node/elisp/Error-Debugging.html] for more details.

vspinu added a commit to vspinu/cider that referenced this issue Aug 13, 2014
@bbatsov
Copy link
Member

bbatsov commented Aug 14, 2014

@Vitoshka suggested that this might be a sync timeout issue. This seems unlikely (as I cannot reproduce the problem even with a tiny timeout value), but I've added an error message for timeouts anyways. Please update and let me know if you see any timeout errors on jack-in/connect.

@julienfantin
Copy link
Author

@bbatsov well that was a good idea!

error in process filter: nrepl-send-sync-request: Sync nREPL request (op eval session nil code (str *ns*)) timed out
error in process filter: Sync nREPL request (op eval session nil code (str *ns*)) timed out

Let me know if I can provide further details.

@vspinu
Copy link
Contributor

vspinu commented Aug 15, 2014

@julienfantin, could you reproduce with a bigger value of nrepl-sync-request-timeout?

@julienfantin
Copy link
Author

@Vitoshka hmmm I've only tried a few times so far, but it has worked every time since I increased it to 30! This seems good, but I'll report back.

@julienfantin
Copy link
Author

Sorry but this isn't fixed for me in the latest version. Ive customized nrepl-sync-request-timeout to 30, but I'm still getting sporadic Sync nREPL errors on connect...

@bbatsov
Copy link
Member

bbatsov commented Aug 19, 2014

What's the error message?

On Wednesday, August 20, 2014, Julien Fantin [email protected]
wrote:

Sorry but this isn't fixed for me in the latest version. Ive customized
nrepl-sync-request-timeout to 30, but I'm still getting sporadic Sync
nREPL errors on connect...


Reply to this email directly or view it on GitHub
#671 (comment).

Best Regards,
Bozhidar Batsov

http://www.batsov.com

@julienfantin
Copy link
Author

@bbatsov

error in process filter: nrepl-send-sync-request: Sync nREPL request (op eval session nil code (System/getProperty "java.version")) timed out
error in process filter: Sync nREPL request (op eval session nil code (System/getProperty "java.version")) timed out

@otfrom
Copy link
Contributor

otfrom commented Aug 20, 2014

+1

I just updated cider this morning (2014-08-20) and got this error:

error in process filter: nrepl-send-sync-request: Sync nREPL request (op eval session nil code (System/getProperty "java.version")) timed out
error in process filter: Sync nREPL request (op eval session nil code (System/getProperty "java.version")) timed out

@bbatsov
Copy link
Member

bbatsov commented Aug 20, 2014

Yeah, I imagined this would still be problematic, but there was not way to fix until nREPL 0.2.4 was out (which happened today). I'll release a new update shortly.

@otfrom
Copy link
Contributor

otfrom commented Aug 20, 2014

Excellent! I was wondering if nREPL 0.2.4 fixed it, but nothing in the changelog jumped out at me. What is the fix?

@bbatsov
Copy link
Member

bbatsov commented Aug 20, 2014

The java version is now supplied in the describe session op's response (alongside the nrepl and clojure versions). The REPL gets created in describe session's callback, but as there was no Java version I either had to remove it from the banner or retrieve it synchronously (which is causing this problem). Oddly enough, I've never been able to reproduce this, but I'll be able to fix it. :-)

@julienfantin
Copy link
Author

Happy to report it's been working flawlessly since the nREPL update 👍

@agarman
Copy link

agarman commented Mar 6, 2015

I am getting this error again:

Starting nREPL server via lein repl :headless...
...
nREPL: Direct connection established
progn: Sync nREPL request timed out (op describe id 3)

@agarman
Copy link

agarman commented Mar 6, 2015

Issue was caused by nrepl-middleware being added.

Add the following to the leiningen profiles.clj to reproduce:
:repl-options {
:nrepl-middleware [io.aviso.nrepl/pretty-middleware]
}

@neverfox
Copy link

@agarman Yes, that's what did it to me too. Did you find a solution?

@agarman
Copy link

agarman commented May 23, 2015

@neverfox I didn't; I stopped using that middleware.

@neverfox
Copy link

@agarman Same. Instead I just inject (io.aviso.repl/install-pretty-exceptions).

@mattiasw2
Copy link

I have a similar problem, but instead I get

error in process filter: Wrong number of arguments: (0 . 0), 1

the first time from Emacs. The second time I succeed (I have get some zoombie java-processes I need to kill).
I am using Windows.

Messages looks like this:

Parinfer extension lispy: It seems Lispy is not installed!
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...
Parinfer extension lispy: It seems Lispy is not installed!
Parinfer: Paren Mode, use C-, to switch to Indent Mode.
Making nrepl-create-client-buffer-function local to nrepl-server sss4 while let-bound!
Making nrepl-use-this-as-repl-buffer local to nrepl-server sss4 while let-bound!
Starting nREPL server via "c:/bin/lein.bat" update-in :dependencies conj ^"[org.clojure/tools.nrepl ^"0.2.12^" :exclusions [org.clojure/clojure]]^" -- update-in :plugins conj ^"[cider/cider-nrepl ^"0.15.0-SNAPSHOT^"]^" -- repl :headless...
nREPL server started on 51861
[nREPL] Establishing direct connection to localhost:51861 ...
[nREPL] Direct connection established
error in process filter: Wrong number of arguments: (0 . 0), 1 [2 times]
Mark set [2 times]

@PlumpMath
Copy link

error in process filter: nrepl-send-sync-request: Sync nREPL request timed out (op eval code

@clojure-emacs clojure-emacs locked as resolved and limited conversation to collaborators Sep 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests