Fork me on GitHub
#nrepl
<
2019-05-01
>
pez07:05:25

@bozhidar: Building nrepl from master I get a third behaviour from Calva. With my test script, using the same bencode and nrepl-client as Calva does, I get consistent behaviour across 0.5.3, 0.6.0, and 0.7.0-SNAPSHOT. But with Calva I get that behaviour only with 0.5.3. However, with 0.6.0 I get an ex message, with a stacktrace pointing me at the same file as you are pointing me at. So I’ll try to see if the nrepl code can help me figure out what I am doing wrong in Calva.

pez08:05:35

One example of “not following” is: “make some changes and test them by starting new nREPL instances from the REPL and connecting to them to see how they are having”.

pez08:05:54

How do I start new instances from the REPL?

pez08:05:32

The example code/session there works. And I do start a server there, is that was is meant in the piece I quoted?

pez08:05:31

As I am seeing the problems I have only in the CLJS REPL, I need some advice on how to do some interactive hacking towards that. I tried to promote/convert the repl by eval:ing (figwheel.main.api/cljs-repl :dev), which might or might not have worked, but don’t really have a clue how to go about it.

bozhidar09:05:58

> How do I start new instances from the REPL?

bozhidar09:05:24

There’s a start-server function in the nrepl.server namespace. I guess we should make this clearer.

bozhidar09:05:35

> How do I start new instances from the REPL?

bozhidar09:05:51

You also have to eval a bit of piggieback code for this to work.

bozhidar09:05:40

That’s how I typically test cljs interactions.

bozhidar09:05:32

> Building nrepl from master I get a third behaviour from Calva. With my test script, using the same bencode and nrepl-client as Calva does, I get consistent behaviour across 0.5.3, 0.6.0, and 0.7.0-SNAPSHOT. But with Calva I get that behaviour only with 0.5.3. However, with 0.6.0 I get an ex message, with a stacktrace pointing me at the same file as you are pointing me at. So I’ll try to see if the nrepl code can help me figure out what I am doing wrong in Calva.

bozhidar09:05:31

I think it’d be easiest for you to just modify that particular function with some debug info and see what’s going on there. What’s the third behaviour you’re getting on master?

bozhidar09:05:47

> With my test script, using the same bencode and nrepl-client as Calva does, I get consistent behaviour across 0.5.3, 0.6.0, and 0.7.0-SNAPSHOT. But with Calva I get that behaviour only with 0.5.3.

bozhidar09:05:03

How come you’re getting different behaviour if you’re using the same client? 🙂

pez09:05:59

Yeah, it is a total mystery for me still, despite having trying to figure it out for a while now. But in my test script I force the communication to be synchronous, so it might well be that what goes wrong in Calva is to due with asynchronisity.

pez09:05:22

With master I get the value and status (`done`) responses, but no out and no ex. (I shouldn’t say I don’t get those, I think I do, but that I somehow mess things up so that they are not delivered to my nrepl client.)

pez11:05:58

Is there any particular profile I should start when jacking in to the nrepl project?

pez12:05:23

I’m using the :master profile and it sort of works. But it seems that being jacked in to the same server as I am developing causes it to start recursing, so maybe I should go about it some other way…

bozhidar12:05:53

I’m simply using the dev profile and I’m connecting to the new servers I start afterwards.

bozhidar12:05:28

Alternatively you can always make some changes, do lein install and use force the use of that build in profiles.clj.

pez13:05:29

There is no dev profile as far as I can see.

dpsutton13:05:24

oh sorry. nrepl 🙂

😃 4
pez13:05:18

Leiningen does not complain when I say I want to use profile dev. And it seems to work. It also seems to me that I modify the server I am connected to when I evaluate forms in the source of that server. But what you are saying, @bozhidar, is that I should create a new server and connect to that one after modifying the source?

pez13:05:21

My mind is actually quite blown away by connecting to the server I am modifying. Starting to realize what happened to Cantor…

😆 4
bozhidar13:05:32

Yeah, you are in essence modifying the server you’re connected to, although certain things are set when the server starts and those can’t be modified on the fly. For those cases you need to start a new server from the updated code.

bozhidar13:05:50

I know what you mean. This was super mind bending to me when I started working on CIDER back in the day.

pez13:05:52

There is a lot of stuff in the msg map. Is there something in particular I should be looking for?

pez14:05:02

When I add some printlns to the function I get StackOverflow when it runs…

pez14:05:42

So, if I start the repl like so:

lein update-in :dependencies conj "[nrepl \"0.7.0-SNAPSHOT\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.21.1\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.nrepl/cider-middleware\"]" -- repl 2> repl-errors.txt
It prints the following. (I do (printn (pr-str msg)) in that function).

pez14:05:15

My terminal stars throwing away input when it grows to large so I catch stderr in a file. Where we find this error:

bozhidar15:05:09

Hmm, a StackOverflow is usually in indication of some endless recursion. That’s weird.

bozhidar15:05:35

Looking at the debug output it seems to be in order, but I assuming that’s from a Clojure session, right?

pez15:05:40

Yeah, I thought that was the Cantor thing first, but then I noticed that it happened before I connected anything. I’ve seen some other errors that indicate it is the pr-str.

pez15:05:49

Looks like so. Including some traces of what else I have tried to do. 😃

pez15:05:27

The session is before I do anything else. So, probably from starting the repl?

pez15:05:04

It lasts a bit longer if I add :headless.

pez15:05:36

Also when removing piggieback and other dependencies things crash if I try to reference that mysterious dev profile. So maybe that profile comes from some of those projects?

bozhidar15:05:46

When I said dev profile I meant I was under the impression that’s what lein runs by default.

bozhidar15:05:21

You can just select Clojure 1.10 or whatever for that matter.

pez15:05:07

At least I can reproduce the problem using that nashorn cljs-repl and such. But if I try to peek at it, with that println, things blow up. Observation changes behaviour, or something.

pez15:05:21

Anyone else that can repro the stackoerflow crash? Just tuck that (println "printing-transport msg: " (pr-str msg)) in there and run:

lein update-in :dependencies conj "[nrepl \"0.7.0-SNAPSHOT\"]" -- update-in :dependencies conj "[cider/piggieback \"0.4.0\"]" -- update-in :dependencies conj "[figwheel-sidecar \"0.5.18\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.21.1\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.nrepl/cider-middleware\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.piggieback/wrap-cljs-repl\"]" -- repl

pez16:05:15

Actually it doesn’t matter what I print. (println "foo") results in the same SO.

pez16:05:18

I'm thinking... Since my first impression was that things started to recurse. Maybe that is what is happening? When I collected the output in that log, it grew very fast. So, maybe the stuff I put in stdout here, gets fed back into the function somehow?

bozhidar17:05:05

I don’t see how this can happen. It should act only on middleware responses.

bozhidar17:05:00

But the SO is certainly indicative of some recursion. Go figure…

pez17:05:19

SO happens in 0.5.3 if I add a println there too. I’m not knowledgeable enough to go figure about it. 😃 But I’m out of ideas on how to inspect the messaging… No.. maybe I can send it to a file…

pez17:05:03

Yeah, spitting it out worked. Now dinner, will examine the output later. 😃

dpsutton17:05:53

is it possible the middleware is set up to handle println and you are println-ing from the middleware giving you the SO?

pez17:05:46

Sounds very possible to me.