nrepl/piggieback

`lein repl` in the piggieback project fails do to a mix of nrepl/nrepl and clojure.tools/nrepl

bhauman opened this issue · 4 comments

I'm reporting this just in case its indicative of a larger issue. And I'd like lein repl to work so that I can test the various cljs repls that I've setup in user.clj
To reproduce:

in the root of this project: lein repl

SEVERE: Unhandled REPL handler exception processing message {:id 11002811-a14c-42e4-b9bf-abb8a74eab27, :op clone}
java.lang.NullPointerException
	at clojure.core$deref_future.invokeStatic(core.clj:2208)
	at clojure.core$deref.invokeStatic(core.clj:2228)
	at clojure.core$deref.invoke(core.clj:2214)
	at cider.piggieback$wrap_cljs_repl$fn__8734.invoke(piggieback.clj:285)
        ;;  vvvvv ------ this is the important bit 
	at nrepl.middleware$wrap_conj_descriptor$fn__8393.invoke(middleware.clj:15)
	at clojure.tools.nrepl.server$handle_STAR_.invokeStatic(server.clj:19)
	at clojure.tools.nrepl.server$handle_STAR_.invoke(server.clj:16)
	at clojure.tools.nrepl.server$handle$fn__9910.invoke(server.clj:28)
	at clojure.core$binding_conveyor_fn$fn__4676.invoke(core.clj:1938)
	at clojure.lang.AFn.call(AFn.java:18)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

As you can see the nrepl/nrepl middleware is in there and its messing stuffs up.

I can't imagine how this can happen - see https://github.com/nrepl/piggieback/blob/master/src/cider/piggieback.clj#L19

I've tested this myself and it works fine with tools.nrepl. The only way for this to fail is at the time piggieback's loaded tools.nrepl is not yet loaded itself. Do you have some init code that might be causing things to load out of order?

Your problem also reminded me of thheller/shadow-cljs#360, which might be similar to your problem.

fixed with 52bd059

Not that piggieback doesn't support tools.nrepl at all (as of 0.4) there's no more potential for ambiguity. I think figwheel and shadow can also drop whatever compatibility code they have.