Fork me on GitHub
#nrepl
<
2018-11-02
>
manas_marthi04:11:43

Tried with a clean .m2 folder and profiles clj matching yours on a Ubuntu vm..

manas_marthi04:11:39

lein nrepl was responding to things like 'a4 or (println 45) but quit or ctrl D did not work

manas_marthi04:11:24

lein repl worked, but it was giving the same namespace error

manas_marthi04:11:15

I have not tried using nrepl as server and connect to it from cider in my spacemacs. I will try that as well..

manas_marthi04:11:53

On an older project lein repl produced same namespace error. I commented lein-nrepl 0.3.0 in profiles.clj. It started working fine. It was showing what version of nrepl and reply it was using. Looks like lein-nrepl 0.3.0 is unable to play nicely with lein or reply

manas_marthi04:11:06

Besides, I switched back to lein-nrepl 0.2.0. and tried lein repl. The server page in http://nrepl.xyz says lein repl will start nrepl if the new nrepl 0.4.5 is on the dependencies list. But the reply prompt is still showing nrepl 0.2.12. Should the doc be changed to lein nrepl?

manas_marthi04:11:37

Can't recall where did I see the steps to connect to nrepl server from cider in emacs 🙂

bozhidar06:11:41

Well, lein repl will work, but it will obviously start a legacy server unless you’ve built lein from source.

bozhidar06:11:40

I have a feeling that the problem is that adding a dep to the newer reply simply messes up the reply dep that comes with lein, but I’m completely puzzled why this works for me and not for you.

bozhidar06:11:55

@dominicm can you test lein nrepl when you’ve got the chance? I’m curious if it will work for you.

dominicm06:11:39

I'll do it when I'm at a keyboard, about 2 hours?

bozhidar06:11:24

Whenever you can. It’s not urgent. I just don’t like unsolved mysteries. 🙂

4
dominicm08:11:15

hmph.

Exception in thread "main" java.lang.ClassNotFoundException: leiningen.nrepl, compiling:(/tmp/form-init391929446154209103.clj:1:72)

dominicm08:11:13

I think the sample profiles.clj is invalid, also:

{:user
 {:dependencies [[cider/cider-nrepl "0.18.0"]]}
 {:plugins [[nrepl/lein-nrepl "0.2.0"]]}}

dominicm08:11:32

That's "things" keys in the top-level map.

dominicm08:11:15

Oh, ignore my exception, it's because i had an old version in the project.

dominicm08:11:10

Okay. Works. REPL-y loads up for me. 🙂

dominicm08:11:23

Unless there's a specific invocation I need to test.

dominicm08:11:38

Oh, I need to test Ctrl-D, I remember 🙂

bozhidar08:11:39

Nope, nothing special.

dominicm08:11:53

Ctrl-D gives me "Bye for now!" then hangs.

dominicm08:11:59

Ctrl-C finishes it off.

bozhidar08:11:31

That’s weird. It should hang only with :headless option.

bozhidar08:11:50

For it me it works just fine. It’s so frustrating when something is 5 lines of code and there are still issues with it. 😄

bozhidar08:11:18

I stand corrected - 6 lines.

dominicm08:11:32

Should be easy to figure out what's keeping it up, one sec

bozhidar08:11:49

So, it should not hang unless :block and :headless are both true.

dominicm08:11:13

or a thread is keeping the jvm up 🙂

dominicm08:11:15

"clojure-agent-send-off-pool-1" #10 prio=5 os_prio=0 tid=0x00007f3f00a03000 nid=0x2112 waiting on condition [0x00007f3ee9e16000] there's a few of these kicking about

dominicm08:11:30

main is waiting on something :thinking_face:

dominicm08:11:46

"main" #1 prio=5 os_prio=0 tid=0x00007f3f0000a800 nid=0x20fd in Object.wait() [0x00007f3f09449000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x000000076cf15e80> (a java.lang.Thread)
        at java.lang.Thread.join(Thread.java:1252)
        - locked <0x000000076cf15e80> (a java.lang.Thread)
        at java.lang.Thread.join(Thread.java:1326)
        at com.hypirion.io.Pipe.join(Pipe.java:120)
        at leiningen.core.eval$sh.invokeStatic(eval.clj:191)
        at leiningen.core.eval$sh.doInvoke(eval.clj:173)

dominicm08:11:06

Maybe I've dumped the threads for the outer JVM?

bozhidar08:11:29

No idea. Reply and nREPL doesn’t use agents at all.

bozhidar08:11:42

That’s why I’m really puzzled how this happens.

bozhidar08:11:22

Btw, after a few days of experimentation I’m finally happy with the state of https://github.com/nrepl/nrepl/pull/66 and I just merged it.

dominicm08:11:41

Neat, I can do that in fireplace/replant too 🙂

bozhidar08:11:03

Originally I had added some nREPL env variables as well, but I opted to remove them as they made more complex the elegant map merging code (now you just have a global, local and command-line maps that are simply merged together in this order) and opened the question what exactly should be the precedence of the env vars.

bozhidar08:11:23

(higher or lower than global config & local config)

bozhidar08:11:31

In the end I decided that less is more. 🙂

dominicm08:11:54

Fun fact, if I add a println after (client), it isn't called when I hit "Ctrl-D"

bozhidar08:11:33

Now I’m completely puzzled.

dominicm08:11:56

(quit) has the same behaviour.

dominicm08:11:15

Actually, I don't see any println from code around (client), so *out* must have an override.

dominicm08:11:21

oh, I fixed it. Somehow.

dominicm08:11:40

Okay. It's not happening anymore. I can't explain why.

dominicm08:11:28

Yes I can. When I run it in aero it hangs, when I run it in lein-nrepl, it doesn't.

dominicm08:11:44

I can also reproduce in bidi.

dominicm08:11:53

@bozhidar what project(s) did you test on?

bozhidar09:11:02

In lein-nrepl and without a project.

dominicm09:11:25

I can't run it without a project, I get:

❯ lein nrepl
Couldn't find project.clj, which is needed for nrepl

bozhidar09:11:02

OK, just tested it another project. It hangs for me as well. Damn, I hate lein at this point…

dominicm09:11:23

😄 so much machinery. I get what Cognitect say about it.

bozhidar09:11:36

Well. lein really overdid it.

bozhidar09:11:54

When I was looking at the code for lein repl I was shocked how much was going on there.

dominicm09:11:07

I just loaded it up 😄

bozhidar09:11:08

boot repl, on the other hand, is 20 lines.

bozhidar09:11:35

I just borrowed some code from boot repl for lein-nrepl but I guess that’s not enough.

bozhidar09:11:54

Anyways, the repl works fine you just have kill it brute-force at the end which is not that bad IMO.

dominicm09:11:47

I wonder if this is relevant though

bozhidar09:11:31

Yeah, I think you found what we were looking for.

bozhidar09:11:43

Looks ugly as hell, but probably it’s needed.

dominicm09:11:00

Apparently not. I just tested, with no luck.

bozhidar09:11:25

I don’t see anything magical though.

bozhidar09:11:19

Ah, no. That’s what’s invoked in lein repl :connect. My bad.

bozhidar09:11:26

Seems you had found the right code.

dominicm09:11:32

Doesn't look like lein install is doing the right thing for me 😞

bozhidar09:11:48

It does it for me.

bozhidar09:11:59

Just make sure you adjust your profile accordingly.

bozhidar09:11:10

And the inner dep of the project.

dominicm09:11:48

That would do it

dominicm09:11:11

Weird how it worked some of the time

dominicm09:11:13

Okay, you're right, System/exit worked

bozhidar09:11:34

It always works. 😉

4
bozhidar09:11:12

Well, I guess you deserve the credit for this, so you can commit the fix directly.

4
bozhidar14:11:38

I’ve cut 0.3.1, so I guess @manas.marthi can check it out.

manas_marthi15:11:12

hi @bozhidar , jar downloaded. no luck yet. I will try on my home laptop later this evening. The only difference is I am using office laptop on windows 10 behind proxy & artifactory.

manas_marthi15:11:17

REPL server started on port 59724 on host localhost - 
REPL-y 0.4.2, nREPL 0.4.5
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_181-b13
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from : [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
WARNING: cat already refers to: #'clojure.core/cat in namespace: net.cgrand.parsley.fold, being replaced by: #'net.cgrand.parsley.fold/cat
user=> (def x 10)
^D
quit

Terminate batch job (Y/N)? y

manas_marthi15:11:00

C:\clojureprojects\201812\archboard>lein repl
nREPL server started on port 59754 on host 127.0.0.1 - 
Exception No namespace: reply.eval-modes.nrepl found  clojure.core/the-ns (core.clj:4032)
CompilerException java.lang.ClassNotFoundException: nrepl.core, compiling:(C:\Users\mman\AppData\Local\Temp\form-init8829266633462961081.clj:1:82)
#object[clojure.lang.Namespace 0x4a439316 "user"]
Error loading namespace; falling back to user
nil
user=>

manas_marthi15:11:57

I will try headless repl and connect from spacemacs

manas_marthi15:11:07

I did not try that option yet

manas_marthi15:11:00

looks like lein nrepl :headless is not the right command

manas_marthi15:11:04

besides lein nrepl made my cpu fan run loudly.

manas_marthi15:11:14

this is a blank project. I have just opened a repl

manas_marthi15:11:44

I am not liking being the messenger with bad news 😞

manas_marthi15:11:46

Qualys cloud agent could be messing with the jvm. It keeps pumping pings to open ports

bozhidar17:11:20

It’s lein nrepl :headless true

bozhidar17:11:43

It was easier for me to have all the args be key/value pairs. 🙂

bozhidar17:11:27

I really wonder if those problems aren’t somewhat related to Windows, but you said you had them on Linux as well.

bozhidar17:11:54

For me after we fixed the hang lein nrepl works perfectly and it seems that’s the case for @dominicm as well.

bozhidar17:11:26

Alternatively you can build lein 2.8.2 from source and use it instead.

bozhidar17:11:58

It’s really a pity they haven’t cut a release so far.

manas_marthi20:11:58

I tried lein nrepl :headless true :middleware "['cider.nrepl/cider-middleware]" and then connected from spacemacs

manas_marthi20:11:09

It is connecting fine except

manas_marthi20:11:08

clj-refactor refactor-nrepl are out of sync. their versions are 2.4.0 (package 20180826.2149) and n/a, respectively.

dominicm23:11:20

Makes sense, you need to add the refactor middleware too 🙂