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-jack-in broken repl with latest from elpa #2092

Closed
twillis opened this issue Oct 2, 2017 · 20 comments · Fixed by clojure-emacs/cider-nrepl#444
Closed

cider-jack-in broken repl with latest from elpa #2092

twillis opened this issue Oct 2, 2017 · 20 comments · Fixed by clojure-emacs/cider-nrepl#444

Comments

@twillis
Copy link

twillis commented Oct 2, 2017

Expected behavior

M-x cider-jack-in and eval anything such as (+ 2 2) repl should output 4

Actual behavior

ERROR: Unhandled REPL handler exception processing message {:ns user, :op eval, :code (+ 2 2)
, :file *cider-repl prjclj*, :line 43, :column 7, :session 0b768c5f-b56a-4ef6-ab5c-3e3cad94718b, :id 13}
java.lang.IllegalAccessError: with-safe-transport does not exist, compiling:(cider/nrepl/middleware/info.clj:1:1)
...

Steps to reproduce the problem

lein new tstprjclj

open the generated project.clj

eval (+ 2 2) in the repl

M-x cider-jack-in

This is extremely important! Providing us with a reliable way to reproduce
a problem will expedite its solution.

Environment & Version information

OSX

CIDER version information

;; Connected to nREPL server - nrepl://localhost:57198
;; CIDER 0.16.0snapshot (package: 20171001.112), nREPL 0.2.12
;; Clojure 1.8.0, Java 1.8.0_40

Lein/Boot version

Leiningen 2.7.1 on Java 1.8.0_40 Java HotSpot(TM) 64-Bit Server VM

Emacs version

GNU Emacs 25.2.1 (x86_64-apple-darwin16.6.0, Carbon Version 157 AppKit 1504.83) of 2017-07-25

Operating system

OSX Sierra 10.12.6

@vspinu
Copy link
Contributor

vspinu commented Oct 2, 2017

Do you set your own cider middleware stack somewhere?

@slipset
Copy link
Contributor

slipset commented Oct 2, 2017

No

@vspinu
Copy link
Contributor

vspinu commented Oct 2, 2017

Most likely a consequence of concurrent namespace loading in clojure. More details in #2078. There is no imediate fix for that, sorry.

@slipset
Copy link
Contributor

slipset commented Oct 2, 2017

Maybe revert #2078 while a fix is being made, since it renders Cider unusable?

@twillis
Copy link
Author

twillis commented Oct 2, 2017

I have a clean .lein/profile.clj and just the clojure layer enabled in spacemacs I did an update this morning and I can't use cider now 😓

@vspinu
Copy link
Contributor

vspinu commented Oct 2, 2017

Maybe revert #2078

#2078 is not a culprit, it's an attempt to solve the problem.

Try the following for time being:

(defun cider--connected-handler ()
  (let ((cider-enlighten-mode nil))
    (cider-make-connection-default (current-buffer))
    (cider-repl-init (current-buffer))
    (cider--check-required-nrepl-version)
    (cider--check-clojure-version-supported)
    (cider--check-middleware-compatibility)
    (cider--subscribe-repl-to-server-out)
    (when cider-auto-mode
      (cider-enable-on-existing-clojure-buffers))
    (sleep-for 0.1) ;; <-- Increase timeout till it works 
    (cider--debug-init-connection)
    (run-hooks 'cider-connected-hook)))

Does the manual sleep-for before debug init solve the problem? If you comment (cider--debug-init-connection) line, does it fix it?

@slipset
Copy link
Contributor

slipset commented Oct 2, 2017

Function as provided above: works
Function as provided above but with ;; (cider--debug-init-connection): works
Function as provided above but with

;; (sleep-for 0.1) ;; <-- Increase timeout till it works 
;;  (cider--debug-init-connection)

works

@vspinu
Copy link
Contributor

vspinu commented Oct 2, 2017

Ok. Then let's add the temporary delay in the master till I figure out how to fix this properly.

Just to check that nothing went wrong with your CIDER install, when removing (sleep-for 0.1), does it work? It would be the same code as in the current master.

@slipset
Copy link
Contributor

slipset commented Oct 2, 2017

Both removing sleep and cider-debug-init-connection worked for me.

@vspinu
Copy link
Contributor

vspinu commented Oct 2, 2017

That means something went wrong with your CIDER installation. Removing sleep-for from the above results in the current CIDER's code in the master.

@slipset
Copy link
Contributor

slipset commented Oct 2, 2017

So, the thing is

  (let ((cider-enlighten-mode nil))
    (cider-make-connection-default (current-buffer))
    (cider-repl-init (current-buffer))
    (cider--check-required-nrepl-version)
    (cider--check-clojure-version-supported)
    (cider--check-middleware-compatibility)
    (cider--subscribe-repl-to-server-out)
    (when cider-auto-mode
      (cider-enable-on-existing-clojure-buffers))
;    (sleep-for 0.1) ;; <-- Increase timeout till it works 
    (cider--debug-init-connection)
    (run-hooks 'cider-connected-hook)))

breaks

but

(defun cider--connected-handler ()
  (let ((cider-enlighten-mode nil))
    (cider-make-connection-default (current-buffer))
    (cider-repl-init (current-buffer))
    (cider--check-required-nrepl-version)
    (cider--check-clojure-version-supported)
    (cider--check-middleware-compatibility)
    (cider--subscribe-repl-to-server-out)
    (when cider-auto-mode
      (cider-enable-on-existing-clojure-buffers))
;    (sleep-for 0.1) ;; <-- Increase timeout till it works 
;    (cider--debug-init-connection)
    (run-hooks 'cider-connected-hook)))

does not break.

Sorry about not testing/being clear on this distinction.

@vspinu
Copy link
Contributor

vspinu commented Oct 2, 2017

clojure-emacs/cider-nrepl#444 should be fixing this. I cannot reproduce the problem on my machine whatever I try, so I will have to rely on you to confirm that the "lock" fix has indeed worked.

@benedekfazekas
Copy link
Member

had the same yesterday. had to downgrade back to latest stable. is the fix on clojars?

@bbatsov
Copy link
Member

bbatsov commented Oct 3, 2017

Not yet.

@bbatsov
Copy link
Member

bbatsov commented Oct 3, 2017

Anyways, more people are welcome to take a look at the relevant PR and provide feedback before we merge it.

@vspinu
Copy link
Contributor

vspinu commented Oct 3, 2017

Please test the proposed fix:

git clone -b deferred-middleware-extras https://github.com/vspinu/cider-nrepl.git
cd cider-nrepl/
lein install
## restart CIDER session in emacs

I cannot come with a small reproducible example to report it on JIRA, but I am fairly confident that it has something to do with the concurrent loading of transitive dependencies.

@benedekfazekas
Copy link
Member

tried but failed to test it due to a corporate firewall :/

@twillis
Copy link
Author

twillis commented Oct 3, 2017

@vspinu new cider-nrepl fixed my issue.

@julienfantin
Copy link

git clone -b deferred-middleware-extras https://github.com/vspinu/cider-nrepl.git
cd cider-nrepl/
lein install

This works with cider-jack-in but still fails for cider-connect:

[nREPL] Establishing direct connection to localhost:7888 ...
[nREPL] Direct connection to localhost:7888 established
nrepl-send-sync-request: Sync nREPL request timed out (op describe)

@vspinu
Copy link
Contributor

vspinu commented Oct 3, 2017

still fails for cider-connect:

That's likely a different issue. You need to update your plugin version on the server side ( :plugins [[cider/cider-nrepl "0.16.0-SNAPSHOT"]], or in case you explicitly list it, new middleware comes under different names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants