This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-22
Channels
- # beginners (55)
- # cider (22)
- # cljs-dev (123)
- # cljsrn (75)
- # clojars (1)
- # clojure (92)
- # clojure-europe (2)
- # clojure-italy (16)
- # clojure-nl (6)
- # clojure-spec (17)
- # clojure-uk (77)
- # clojured (2)
- # clojurescript (39)
- # core-async (8)
- # cursive (4)
- # data-science (1)
- # datomic (22)
- # duct (4)
- # editors (21)
- # emacs (10)
- # events (4)
- # fulcro (116)
- # graphql (8)
- # immutant (3)
- # jackdaw (1)
- # juxt (3)
- # kaocha (4)
- # luminus (1)
- # mount (1)
- # nrepl (32)
- # off-topic (34)
- # other-languages (5)
- # pedestal (32)
- # reagent (1)
- # ring (6)
- # ring-swagger (7)
- # shadow-cljs (5)
- # spacemacs (3)
- # specter (1)
- # sql (1)
- # vim (21)
@cichli I've had a bug report come my way which appears to be a bug in nrepl 0.6.0's printing stack. https://github.com/rgm/reframe-template/issues/1 I can't see how the replying-PrintWriter function is ever being called, because vim will never send stream? true
. Somehow it looks related to the piggieback stack? But I'm not sure of that much either. I was hoping something might stand out to you as why that would be called with that particular stack?
https://github.com/nrepl/nrepl/blob/7721f2f8910faa00a278b52d608a1a6781c2fe0e/src/clojure/nrepl/middleware/interruptible_eval.clj#L76 looks like interruptible eval uses this directly.
It might be a piggieback issue, it does some manual bookkeeping to make sure *out*
and *err*
are bound correctly. But I’m not sure why transport
would be nil
What exactly does :Piggieback
eval to start the cljs repl?
java.lang.Exception: Stack trace
at java.base/java.lang.Thread.dumpStack(Thread.java:1387)
at nrepl.middleware.print$replying_PrintWriter.invokeStatic(print.clj:105)
at nrepl.middleware.print$replying_PrintWriter.invoke(print.clj:99)
at nrepl.middleware.interruptible_eval$evaluate.invokeStatic(interruptible_eval.clj:76)
at nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:55)
at nrepl.middleware.session$create_session$fn__8988.invoke(session.clj:143)
at nrepl.middleware.session$create_session.invokeStatic(session.clj:142)
at nrepl.middleware.session$create_session.invoke(session.clj:124)
at nrepl.middleware.session$register_session.invokeStatic(session.clj:201)
at nrepl.middleware.session$register_session.invoke(session.clj:197)
at nrepl.middleware.session$session$fn__9029.invoke(session.clj:267)
at nrepl.middleware$wrap_conj_descriptor$fn__8584.invoke(middleware.clj:16)
at cider.nrepl$wrap_enlighten$fn__9440.invoke(nrepl.clj:162)
at nrepl.middleware$wrap_conj_descriptor$fn__8584.invoke(middleware.clj:16)
at nrepl.middleware.print$wrap_print$fn__8808.invoke(print.clj:238)
at nrepl.middleware$wrap_conj_descriptor$fn__8584.invoke(middleware.clj:16)
at nrepl.server$handle_STAR_.invokeStatic(server.clj:18)
at nrepl.server$handle_STAR_.invoke(server.clj:15)
at nrepl.server$handle$fn__9066.invoke(server.clj:27)
at clojure.core$binding_conveyor_fn$fn__5739.invoke(core.clj:2030)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Oh, fwiw, this is the trace of creating the printwriterPiggieback does https://github.com/tpope/vim-fireplace/blob/1ef0f0726cadd96547a5f79103b66339f170da02/plugin/fireplace.vim#L323-L325
So (cider.piggieback/cljs-repl (whatever-you-give-it))
^ some of the numbers in the stack may be out a little, I've been sprinkling println debugging in
https://github.com/nrepl/nrepl/blob/7721f2f8910faa00a278b52d608a1a6781c2fe0e/src/clojure/nrepl/middleware/session.clj#L140 this looks like it could be the issue? Transport isn't being conveyed here
Just realised the same thing 😄
As a workaround: just make sure you eval something in the session before calling piggieback
I think we don’t want to pass transport
there – otherwise initialising the bindings would cause responses to be sent on the transport
But piggieback should definitely be creating new PrintWriter
s for each eval message, same as nrepl does. Capturing them from @session
is relying on nrepl implementation details
That workaround may not work. I think fireplace creates a new session for cljs, which is only available there.
Just looking at the fireplace code, it looks like it does clone
up a new session (see line 308). Does adding connection.eval("nil")
on the line before the piggieback eval
workaround the problem?
It shouldn’t be needed with the new piggieback though
1. bump to 0.4.1-SNAPSHOT, 2. Patch fireplace.vim, 3. Make sure a cljs-repl was started in the terminal REPL, before trying to run :Piggieback
so it’s finally working (piggieback + vim/fireplace + figwheel + deps.edn) and I made some notes here: https://github.com/rgm/reframe-template/issues/1#issuecomment-466619263
You might be able to poke at fireplace to figure it out, but it's not an easy workaround 🙂
You’re right, it doesn’t use persistent sessions at all IIRC
I have to go catch a train in a few minutes but I’ll get a fix into piggieback this afternoon
@cichli that's awesome, thank you! ❤️ This was an interesting one to poke at, reminded me that I need to spend some more time working on nrepl 🙂
@rgm @dominicm any chance you could retest with [cider/piggieback "0.4.1-SNAPSHOT"]
?
Just tried it and with 0.5.3 and 0.6.0/pback 0.4.1-snapshot I get the same ... progress (?) from this comment: https://github.com/rgm/reframe-template/issues/1#issuecomment-466411581
(This has that feeling like there’s a stack of errors of use, my own misconceptions and new-to-discover minor bugs that I’ll just have to pop one by one, so I really appreciate the help).
If I connect to a regular Clojure REPL and start a CLJS REPL manually with: (cider.piggieback/cljs-repl (figwheel.main.api/repl-env "config/dev"))
then I don’t get the nil
IReplEnvOption
error, but the first evaluation does raise that same Error: Cannot find module '@cljs-oss/module-deps'
so it’s finally working (piggieback + vim/fireplace + figwheel + deps.edn) and I made some notes here: https://github.com/rgm/reframe-template/issues/1#issuecomment-466619263