Fork me on GitHub
#cljsrn
<
2021-05-10
>
Oliver George00:05:26

Stand down red alert. Clearly my env variables didn't make it to the node invocation. This worked...

raspasov00:05:07

Yup… That has tripped me before.

dnolen13:05:38

@laynor those look like tools deps problems?

dnolen13:05:46

I don't see how Krell is involved in that trace

dnolen13:05:02

I would delete .cpcache and ~/.gitlibs and try again

Ale13:05:53

I already deleted everything - actually I had a friend install the tools from scratch (not a clojure user), and he had the same result. I myself tried to reinstall every tool (java, node, clojure etc) starting from a newly created user on my machine. I'm installing node with nvm, android studio, sdk and clojure on the home directory, so the only shared dependency is (to my knowledge) java.

Ale13:05:30

reverting to an older krell version fixed the issue, as outlined in the bug report

Ale13:05:21

I'm not saying the problem is not in the tools - just that the previous krell version did not trigger the issue

dnolen13:05:20

if it persists I think probably need to ask in #tools-deps on how to debug

dnolen13:05:29

@laynor we're using shas close to master on two projects and I haven't seen this one

dnolen13:05:45

I don't think anything else on your system matters - the failure is from tools-deps

dnolen13:05:55

the blame can't be on Node, or Java, or Clojure or anything else

dnolen13:05:22

it's true, it could be in Krell, I'll try the tutorial now and see what happens

Ale13:05:06

@dnolen the same project worked worked correctly on @pez machine - from an outsider point of view, it looks like it's dependent on the particular os I'm using, which is the same of the friend's machine on which I replicated the issue

Ale13:05:10

In particular, an up to date Arch linux machine

Ale13:05:50

Arch is quite quick with releasing updates so it might be triggered by some "new" package version

Ale13:05:08

I honestly have no clue aside from observing the behavior

Ale13:05:14

I can bisect to reach the problematic commit - what directories would you suggest to delete at each try? @dnolen would .cpcache target ~/.gitlibs be enough?

dnolen13:05:16

tools-deps still has caching / sha fetch bugs from what I can tell

dnolen13:05:30

I hit some on M1 and had to switch to dev version

dnolen13:05:47

but even on non-M1 Apple hardware I occasionally hit null-pointer exceptions when constructing the classpath

Ale13:05:24

I see - I haven't seen NPEs, but I can switch to the dev version if that can help in some way - just don't really know how

Ale13:05:43

I'm very much a beginner with clojure, just played long ago

Ale13:05:07

I'll start bisecting and let you know

dnolen13:05:53

Error building classpath. Cannot invoke "java.io.File.isAbsolute()" because "f" is null
java.lang.NullPointerException: Cannot invoke "java.io.File.isAbsolute()" because "f" is null

dnolen13:05:01

@laynor that is from your bug report above

dnolen13:05:04

that is an NPE

Ale13:05:11

uh, you're right

Ale13:05:42

I was thinking about the topmost exception and forgot about the inner one, sorry

dnolen13:05:22

re: Cider this one is more annoying

dnolen13:05:05

but I think I see the problem

Ale13:05:17

oh, but wait - that one I solved

Ale13:05:26

that's not the issue I'm talking about

Ale13:05:38

this is it

Ale13:05:13

I was just checking the stack trace to see if I had actually forgotten the NPE - but I don't see any in the stack trace in my bug report on GH.

Ale13:05:03

the NPE I reported here on the channel was due to some problem with the git SHAs that I copied from the tutorial or from the readme itself.

Ale14:05:44

the tutorial references

io.vouch/reagent-react-native {:git/url ""
                                       :sha "0d25830bd0bf02baf272b9c60d3edefc6766ef24"}

Ale14:05:59

so I went on and used the latest hashes for both krell and reagent-react-native

Ale14:05:26

and finally got the error that I reported on the GH issue

dnolen14:05:58

erg sorry yeah fixed it up

Ale14:05:13

I must say, it was a very confusing error for a non-existent hash

dnolen14:05:12

the Cider thing is a bit less clear to me

dnolen14:05:30

what happens is that Krell does not even try to connect until cljs.core is loaded to avoid this kind of issue

dnolen14:05:08

So Krell startup is blocked, and thus Cider startup is blocked until the RN environment connects (which is after cljs.core is available)

dnolen14:05:37

so at least at first glance I cannot understand it since this is the exact same bug I had to fix for cljs.main style interaction

Ale14:05:47

I was watching the commit introducing these lines yesterday, as it was the most suspect from an outsider point of view, but going back did not solve the issue as you might suspect. I might not have cleaned everything properly at the time though.

dnolen14:05:28

@laynor so in the Metro terminal do you see "Connected to Krell REPL Server"

Ale14:05:53

I was just setting up a script to automate the cleaning/building etc to let you know, as if I remember correclty, I do see it

Ale14:05:18

@dnolen this is from the output of npx react-native start

LOG  Running "Dondai" with {"rootTag":11}
 LOG  Connected to Krell REPL Server
 ERROR  Could not evaluate form: (cljs.core._STAR_print_namespace_maps_STAR_ = true) [ReferenceError: Can't find variable: cljs]

dnolen14:05:49

@laynor what happens when you refresh Metro?

Ale15:05:41

the repl stays stuck, and the "Could not evaluate form: ..." line is not printed

Ale15:05:46

if i try reconnecting, the same error is raised

dnolen15:05:06

this could very well be a Cider issue - sounds pretty weird

dnolen15:05:02

or Cider/Piggieback issue

dnolen15:05:41

@laynor I don't use Cider and not super interested in spending time figuring out Cider/Piggie specific prbolems

dnolen15:05:54

too much time wasted w/ that stuff for me to ever look at it again

dnolen15:05:05

debugging Krell is trivial

dnolen15:05:26

you can edit krell_repl.js and drop some console.logs

dnolen15:05:47

don't ClojureScript compile/recompile, just start the app and try to connect the REPL

dnolen15:05:52

and you should see your logging

dnolen15:05:13

the situation you're describing seems impossible but maybe a bit more logging when the REPL connects will clarify something

Ale15:05:52

I'll try to investigate and let you know - I'm now bisecting

Ale15:05:15

a bit of a long process because of issues with react-native-tcp-socket

dnolen15:05:43

@laynor one thing is why you need Cider though - are you using Calva?

dnolen15:05:03

if you're not using Calva and you're doing ClojureScript there's is no benefit

dnolen15:05:16

and really Calva should support standard REPLs

dnolen15:05:26

tooling that starts w/ nREPL is fundamentally broken in IMO

Ale15:05:03

I tried both - and same issue in both of them

Ale15:05:23

I'm using emacs

Ale15:05:06

but lsp is kinda broken (missing docs, cannot jump on some functions) so I'm using cider

dnolen15:05:54

@laynor hrm I'm very skeptical about cljs.main issues

dnolen15:05:06

did you try outside of the editor a la tutorial?

Ale15:05:19

you mean the repl? it works flawlessly

dnolen15:05:22

ah k Emacs - sorry right other reason to Cider

dnolen15:05:45

yeah I would put a little a bit of debugging to see

dnolen15:05:59

I just don't see how Cider could connect and then cljs fail to evail

Ale15:05:07

I have 1/10th the clues you have 😆 Are you using jetbrains' stuff?

dnolen15:05:27

target/krell_repl.js like I said

dnolen15:05:33

if you don't compile then this file is not touched

dnolen15:05:37

this is how I debug Krell

dnolen15:05:53

those lines I linked to in the source above would give you all the info

dnolen15:05:04

i.e. how can cljs.core not be available

dnolen15:05:20

you can add more console.log s right there

dnolen15:05:06

@laynor re: what I use - anything that let's me use cljs.main approach - I use IntelliJ, but I also use the shell

dnolen15:05:29

when I was in Emacs I switched to clj-inf to avoid the issues

Ale15:05:15

I see - I'm not very well versed- very much a beginner - so I don't really know about the different approaches out there. I'll try to look into it.

Ale15:05:41

anyway, fwiw, the issue appears somewhere from d0e1153 to d0e1153, with 6154649 still giving me a mostly working cljs prompt but riddled with errors (http://goog.xyz already declared, I've seen some related fixes in the git log)

dnolen15:05:42

@laynor one dummy check

dnolen15:05:56

your target/krell_repl.js must look like exactly the one in master

dnolen15:05:59

if it doesn't - not going to work

dnolen15:05:23

basically I'm saying the behavior you are seeing simply doesn't not seem possible

dnolen15:05:28

so check some assumptions

Ale15:05:07

shall I use krell's master version and double check target/krell_repl.js?

dnolen15:05:12

I mean compare your not working thing w/ master

dnolen15:05:30

if your krell_repl.js does not look like master then your bug report makes perfect sense

dnolen15:05:39

because that was fixed

dnolen15:05:17

and if it's not fixed version for you locally - then it cannot work

Ale15:05:33

this is the diff:

[ale:~/src/krelltest] master(+1792/-15603)* ± diff repl_tmp.js target/krell_repl.js
15,16c15,16                                           
< var SERVER_IP = "$KRELL_SERVER_IP";                 
< var SERVER_PORT = krellPortMap ? krellPortMap[DeviceInfo.getDeviceId()] || $KRELL_SERVER_PORT : $KRELL_SERVER_PORT;
---                                                   
> var SERVER_IP = "192.168.11.14";                    
> var SERVER_PORT = krellPortMap ? krellPortMap[DeviceInfo.getDeviceId()] || 5001 : 5001;
18c18                                                 
< const KRELL_VERBOSE = $KRELL_VERBOSE;               
---                                  
> const KRELL_VERBOSE = false;            
[ale:~/src/krelltest] master(+1792/-15603)* 1 ± npx react-native start

Ale15:05:47

issue as detailed on github - LOG Running "Dondai" with {"rootTag":11} LOG Krell sez howdy, Device ID: goldfish_x86 LOG Connected to Krell REPL Server ERROR Could not evaluate form: (cljs.core.STARprint_namespace_maps_STAR_ = true) [ReferenceError: Can't find variable: cljs]

dnolen16:05:39

can you enumerate the Android platform details you're trying this with

Ale16:05:54

Installed packages:=====================] 100% Computing updates...             
  Path                                     | Version      | Description                             | Location                                 
  -------                                  | -------      | -------                                 | -------                                  
  build-tools;29.0.2                       | 29.0.2       | Android SDK Build-Tools 29.0.2          | build-tools/29.0.2/                      
  build-tools;30.0.3                       | 30.0.3       | Android SDK Build-Tools 30.0.3          | build-tools/30.0.3/                      
  emulator                                 | 30.6.5       | Android Emulator                        | emulator/                                
  ndk;22.1.7171670                         | 22.1.7171670 | NDK (Side by side) 22.1.7171670         | ndk/22.1.7171670/                        
  patcher;v4                               | 1            | SDK Patch Applier v4                    | patcher/v4/                              
  platform-tools                           | 31.0.2       | Android SDK Platform-Tools              | platform-tools/                          
  platforms;android-29                     | 5            | Android SDK Platform 29                 | platforms/android-29/                    
  platforms;android-30                     | 3            | Android SDK Platform 30                 | platforms/android-30/                    
  sources;android-30                       | 1            | Sources for Android 30                  | sources/android-30/                      
  system-images;android-30;google_apis;x86 | 9            | Google APIs Intel x86 Atom System Image | system-images/android-30/google_apis/x86/

Ale16:05:09

avd is on api 30

dnolen16:05:14

@laynor ok looks ok, which actual emulator? Pixel 3/4?

Ale16:05:30

pixel 3a

dnolen16:05:01

you're not trying to use Hermes or doing anything like that right?

Ale16:05:05

the default one android studio installs - I removed my old android studio install

Ale16:05:23

never even heard about it

dnolen16:05:52

finally you get no ERROR s about file failing to load?

Ale16:05:57

TBH, before krell I was playing with shadow-cljs/expo but was encountering repl disconnects and other weird errors so I wanted to switch to krell to make the stack a bit less deep

dnolen16:05:06

that would be only other reason cljs.core didn't appear

dnolen16:05:20

because something failed to load before it failing everyone after it

Ale16:05:47

where would I see these errors?

dnolen16:05:54

as ERROR ...

Ale16:05:25

no other errors

dnolen16:05:38

and this is with the tutorial?

dnolen16:05:50

I can try on Android now that we've narrow it down

Ale16:05:23

you can even try my project, I posted the url on github - It'll most likely just work for you as it did for @pez

Ale16:05:33

I mean on the github issue

Ale16:05:49

it's just the krell hello world, nothing fancy

Ale16:05:26

it's probably referencing some older version because at that time I tried to make the version of every package coincide with the ones @pez was using.

pez16:05:03

Yeah. Works like a charm on my Mac. Very strange.

dnolen16:05:26

@laynor this could be Android / Linux problem I'm trying to think about why ...

dnolen16:05:42

@laynor while I'm poking at this try Pixel4

Ale16:05:42

@dnolen api level 30 ok? (android R)

dnolen16:05:11

I mean Android version is mostly important for compatibility with react-native-tcp-socket - for the REPL part

dnolen16:05:31

but Krell now longer requires a REPL to function - so support for various Android devices is much wider now

dnolen16:05:56

but 30 should be OK for REPL that's what I'm using

Ale16:05:10

alright, it's installing

dnolen16:05:03

fwiw, on OS X I'm testing Pixel 3 API 30 right now

Ale16:05:56

no luck for me with pixel 4 - I'm kinda confident it'll work for you though

dnolen16:05:19

Krell was able to build the app - now verifying REPL connect

dnolen16:05:44

yeah all works

Ale16:05:03

appears to be linux-specific, doesn't it

dnolen16:05:09

@laynor do you have Android device?

Ale16:05:16

real device? yup

dnolen16:05:20

that would eliminate Linux environmnet oddities

dnolen16:05:59

npx react-native run-android but w/ your device connected

Ale16:05:44

lemme grab a cable, last test before going to bed, it's almost 2am here ^^;

Ale16:05:58

@dnolen same issue with the physical device

Ale17:05:00

btw, when I add logs and try to reconnect with cider, my krell_repl.js is overwritten

Ale17:05:06

the app appears to be recompiling or something

Ale17:05:19

this may sound ridiculous but still - I removed write permissions from the krell_repl.js file, tried to reconnect, got this error on the repl

nil#'user/configExecution error (FileNotFoundException) at java.io.FileOutputStream/open0 (FileOutputStream.java:-2).
target/krell_repl.js (Permission denied)
no errors in the metro terminal, and a working cljs repl

Ale17:05:45

there must be something wrong re. the automatic rebuild on repl connection

dnolen17:05:07

hrm, let's pick it up tomorrow

dnolen17:05:20

if you're not manually recompiling krell_repl.js should not be overwritten

dnolen17:05:44

so Cider/Piggie could very well be doing something very yucky

dnolen17:05:48

which is messing everything up

dnolen17:05:50

would not be first time

dnolen17:05:00

oh but this still plain REPL, nvm?

dnolen17:05:10

oh Cider ..

dnolen17:05:24

let's keep Cider out of this please until we can isolate 🙂

dnolen17:05:32

unless you said above that plain REPL always works

Ale17:05:37

the plain repl (as in clj -M ... -r) works flawlessly, as I said before

Ale17:05:45

the issue arises just with calva/cider

dnolen17:05:51

so then this might be it

dnolen17:05:57

Cider/Piggie may be doing something horrible

Ale17:05:08

but only on the newer krell versions for some reasons

dnolen17:05:25

well because newer Krell is the right way

dnolen17:05:29

everything before was in fact broken

dnolen17:05:33

the new Krell has no issues

dnolen17:05:41

you never even need to restart the damn thing once you start the REPL once

dnolen17:05:44

it never hangs

dnolen17:05:51

it always flawless reconnects

dnolen17:05:01

it survivs RN refresh

dnolen17:05:06

app re-install

dnolen17:05:16

all possible scenarios and the REPL never needs to be restarted

dnolen17:05:29

so the fact that Cider worked before isn't important

dnolen17:05:39

Cider was broken and Krell were broken together

dnolen17:05:53

now Krell works - but Cider is doing something strange

Ale17:05:02

all the niceties after d0e115309580ca0bdc782e4ca396df66a357d212 then?

dnolen17:05:32

yes once I changed Krell to always a produce a working RN app and to reuse Metro / fetch

Ale17:05:32

I see - so we have a test case for the cider/piggie guys?

dnolen17:05:56

all the crazy bugs went away - iOS worked, Android works - and a dev can work even if they don't use a REPL

dnolen17:05:07

fewer deps, etc. etc.

Ale17:05:02

I'd really like the two to go well together, cider is pretty handy and well integrated in emacs

dnolen17:05:27

@laynor it's possible - tomorrow we can try it verbose mode and you can probably see that Cider forces a recompile somehow

Ale17:05:41

probably there's a way to stop it

Ale17:05:34

let's take a look tomorrow then, thanks for the help today :)