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

Can't connect to multiple nrepls #1122

Closed
arohner opened this issue Jun 12, 2015 · 10 comments
Closed

Can't connect to multiple nrepls #1122

arohner opened this issue Jun 12, 2015 · 10 comments
Labels

Comments

@arohner
Copy link

arohner commented Jun 12, 2015

Running cider git checkout of HEAD, 3487955

I'm trying to create multiple nrepl connections, to multiple processes, and can't. A typical workflow for me is to have a CLJ nrepl running, and a second to figwheel, for CLJS.

Steps:

M-x cider-connect "localhost" 6005
M-x cider-connect "localhost" 7888 (figwheel nrepl)

The first connection works just fine. The second connection is "defective". M-x cider-connect reports "Direct connection established", but emacs doesn't automatically open the second buffer. If I manually switch to "cider-repl localhost<2>", there is no repl prompt, and typing in the buffer has no effect.

If I kill both buffers, do the steps in opposite order, and get same result:

M-x cider-connect "localhost" 7888
M-x cider-connect "localhost" 6005

In this case, the 7888 buffer works correctly, and the 6005 buffer is defective.

The bug doesn't appear to have anything to do with figwheel, I can also reproduce it using two normal CLJ nrepls:

M-x cider-connect "localhost" 6005
M-x cider-connect "localhost" 6006

Note that connecting to the same process twice works fine:

M-x cider-connect "localhost" 6005
M-x cider-connect "localhost" 6005

In this case, both buffers work as expected.

@bbatsov
Copy link
Member

bbatsov commented Jun 15, 2015

Hmm, that's pretty odd. @expez @benedekfazekas @cichli Can you reproduce this problem?

@bbatsov
Copy link
Member

bbatsov commented Jun 15, 2015

@arohner I can't reproduce this. I'd suggest going through the "Troubleshooting" section of the README and debugging interactively the REPL init to see what goes wrong for you.

@arohner
Copy link
Author

arohner commented Jun 15, 2015

I've enabled toggle-debug-on-error. No popups. Nothing suspicious in Messages. Attempting to type in the 'broken' repl results in the following in nrepl-messages:

(--->
  ns  "user"
  op  "eval"
  session  "4f73b935-d209-4878-81f7-21c13430242e"
  code  "\n"
  id  "5"
)
(<-
  id  "5"
  session  "4f73b935-d209-4878-81f7-21c13430242e"
  status  ("unknown-session" "error")
)

@bbatsov
Copy link
Member

bbatsov commented Jun 17, 2015

Seems it's trying to evaluate code in some unknown session, but without being able to reproduce it we'll have hard time fixing it.

@lgrapenthin
Copy link

I think I have the same problem, however I can workaround by opening a different buffer than the first REPL before entering cider-connect. Btw. this problem existed in Cider 0.8 already.

@arrdem
Copy link
Contributor

arrdem commented Jun 18, 2015

Bumping this because I hit it just now. With one nREPL connection to a work host, I was unable to open a second connection to the same host on CIDER 0.9

@bbatsov
Copy link
Member

bbatsov commented Jun 19, 2015

Can some of you investigate this in edebug. It's pretty simple and I can't do it myself as I can't reproduce it. Check out the troubleshooting section of the README for details.

@lgrapenthin
Copy link

The problem is that when a REPL is currently open, nrepl-connection-buffer is set to it. All requests are made to that repl buffer instead of the newly created buffer. A workaround is to modifiy nrepl-start-client-process so that nrepl-connection-buffer is nil before nrepl--init-client-sessions is invoked, so that the buffer is looked up in the connection ring. I'd make a PR but my knowledge of this codebase is too narrow to fix it appropriately.

@bbatsov
Copy link
Member

bbatsov commented Jun 19, 2015

OK, got it. That's why I couldn't reproduce this - I never started the second connection when in a REPL buffer.

@vspinu You authored this code. Would like to fix it or should I do this?

@bbatsov bbatsov added the bug label Jun 20, 2015
@vspinu
Copy link
Contributor

vspinu commented Jun 20, 2015

That's why I couldn't reproduce this - I never started the second connection when in a REPL buffer.

Me too.

@vspinu You authored this code. Would like to fix it or should I do this?

Fixed.

bbatsov added a commit that referenced this issue Jun 20, 2015
[Fix #1122] Run client initialization in new client buffer
bbatsov added a commit that referenced this issue Jun 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants