Fork me on GitHub
#shadow-cljs
<
2017-10-24
>
thheller09:10:31

hmm just found a rather big bug related to how npm requires are resolved

thheller09:10:35

should fix a whole bunch of packages

mhuebert10:10:48

what were some that were affected?

mhuebert11:10:24

hmm, it apperas that shadow-cljs servers remain running when terminal windows are closed? not sure which java processes they are, they also don’t seem to respond to requests

thheller11:10:48

hmm is the node process controlling them still alive?

mhuebert11:10:48

I don’t see any node processes

mhuebert11:10:56

also when i try to watch, it connects to server and then seems to hang:

mattpro:shadow-re-frame MattPro$ npx shadow-cljs watch browser
shadow-cljs - config: /Users/MattPro/Documents/sites2017/shadow-re-frame/shadow-cljs.edn version: 2.0.37
shadow-cljs - connected to server

thheller11:10:18

that might be because the watch is still running

thheller11:10:24

should get output once something happens

thheller11:10:56

you are still using lein?

mhuebert11:10:06

not for this project

thheller11:10:40

there is one bug I’m trying to track down

thheller11:10:47

is the java process consuming CPU? like 100% of one core?

mhuebert11:10:53

no, all quiet

mhuebert11:10:14

editing a file doesn’t appear to trigger anything

thheller11:10:29

[email protected] fixes another issue related to npm requires with browser overrides

thheller11:10:53

also fixed maybe one potential issue related to the java process staying alive

mhuebert11:10:55

i will just force quit the rest of these processes. i started doing that and now i’m in a state where nothing works at all

thheller11:10:44

is this reproducible by just closing the terminal?

mhuebert11:10:27

not sure, i am still in a broken state, force quitting seems to be not the nicest 🙂

mhuebert11:10:38

mattpro:shadow-re-frame MattPro$ npx shadow-cljs watch browser
shadow-cljs - config: /Users/MattPro/Documents/sites2017/shadow-re-frame/shadow-cljs.edn version: 2.0.39
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:58762
    at Object.exports._errnoException (util.js:1034:11)
    at exports._exceptionWithHostPort (util.js:1057:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1096:14)

mhuebert11:10:56

in activity monitor i can’t find any node or java processes at all

thheller11:10:09

delete the target/shadow-cljs/*.port files

thheller11:10:04

usually those are removed when the jvm exits

thheller11:10:10

but if you kill it that doesn’t happen

mhuebert11:10:44

yeah, starting a new server/watch and closing the terminal reproduces it

mhuebert11:10:05

web server doesn’t return requests, can’t run a new server/build

mhuebert11:10:46

when i force quit the java process then immediately the browser’s hung request stops and says “ERR_CONNECTION_REFUSED”

thheller11:10:13

ok, got it reproduced

thheller11:10:52

hmm the jvm is properly shutdown, just doesn’t quit

thheller11:10:30

seems to be related to the node process launching the java process

thheller11:10:42

when I run it directly without the node process it exits properly

mhuebert15:10:39

2.0.39 with maria:

[:live] Build failure:
NullPointerException:
	clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:301)
	shadow.build.npm/find-package-json (npm.clj:78)
	shadow.build.npm/find-package-json (npm.clj:77)
	shadow.build.npm/find-package-for-file (npm.clj:90)
	shadow.build.npm/find-package-for-file (npm.clj:89)
	shadow.build.npm/find-resource* (npm.clj:604)
	shadow.build.npm/find-resource* (npm.clj:592)
	shadow.build.npm/find-resource (npm.clj:670)
	shadow.build.npm/find-resource (npm.clj:652)
	shadow.build.resolve/fn--20914 (resolve.clj:81)
	shadow.build.resolve/fn--20914 (resolve.clj:78)
	clojure.lang.MultiFn.invoke (MultiFn.java:238)
	shadow.build.resolve/find-resource-for-symbol (resolve.clj:191)
	shadow.build.resolve/find-resource-for-symbol (resolve.clj:157)
	shadow.build.resolve/resolve-symbol-require (resolve.clj:205)
	shadow.build.resolve/resolve-symbol-require (resolve.clj:201)
	shadow.build.resolve/resolve-require (resolve.clj:235)
	shadow.build.resolve/resolve-require (resolve.clj:231)
	shadow.build.resolve/resolve-deps/fn--20895 (resolve.clj:56)
	clojure.lang.PersistentVector.reduce (PersistentVector.java:341)
	clojure.core/reduce (core.clj:6752)
	clojure.core/reduce (core.clj:6735)

thheller15:10:00

those damn symbols 😛

thheller15:10:17

seems like I need to restructure my whole CLI script just to fix those damn orphan java processes

thheller15:10:49

var cp = require("child_process");

cp.spawnSync("java", ["-cp", "../target/classes", "Test"], {stdio: "inherit"});

thheller15:10:07

simple java process that just reads from stdin .. doesn’t die

thheller15:10:02

can’t figure out why … simple programs like nc -l localhost 8001 exit after a bit

thheller15:10:51

seems like I really have to go down the async route now 😞

mhuebert16:10:37

hmm, somehow an error like this doesn’t display the filename alongside the error:

[:bootstrap] Build failure:
Invalid namespace declaration
In: [2] val: ((:require [clojure.walk :refer :all] [thi.ng.dstruct.core :as d] [thi.ng.xerror.core :as err])) fails spec: :shadow.build.ns-form/ns-form predicate: (cat :docstring (? string?) :meta (? map?) :clauses :shadow.build.ns-form/ns-clauses),  Extra input

thheller16:10:20

thats the entire error?

thheller16:10:42

apart from being a terrible spec error

mhuebert16:10:34

yeah i am hoping that those will get better. https://github.com/bhb/expound/ looks interesting.

mhuebert16:10:44

its surprisingly hard to read.

thheller16:10:02

yes, its absolutely terrible

thheller16:10:17

I can’t make it out

thheller16:10:43

I tried expound before, it didn’t seem to handle syntax all that well

thheller16:10:15

worked ok on maps in general

thheller16:10:36

but complex specs like the ns form spec didn’t get any easier to read

thheller16:10:42

but its been a while maybe its better now

thheller16:10:22

nevertheless it should at least show a filename

mhuebert16:10:21

i know you’re busy with the process stuff now, just making note of this bootstrap thing i’m trying to get to work

mhuebert16:10:06

after that ns related error led me to thi.ng.geom.core.macros.vector, non-selfhost-friendly macros namespace, so I put that in :exclude. then it fails with this math namespace.

mhuebert16:10:31

lib is [ "0.0.908"],` (:require [thi.ng.geom.svg.core :as svg])`

thheller16:10:03

Retrieving org/clojure/clojurescript/0.0-3117/clojurescript-0.0-3117.pom from central

thheller16:10:10

they are some outdated dependencies in there 😛

mhuebert16:10:38

yeah it is a bit old. but karsten has written some really good and high performance stuff

thheller16:10:42

which entries did you use for bootstrap?

mhuebert16:10:07

m i just added [thi.ng.geom.svg.core :as svg] to the require of an entry that was in bootstrap

mhuebert16:10:32

i did it in the shadow-bootstrap-example, just added [ "0.0.908"] to deps plus that require

thheller16:10:28

yep got the error

thheller16:10:56

[:bootstrap-support] Compiling ...
failed to inspect cljs file: jar:file:/Users/zilence/.m2/repository/thi/ng/geom-core/0.0.908/geom-core-0.0.908.jar!/thi/ng/geom/core/macros/vector.clj
Invalid namespace declaration
In: [2] val: ((:require [clojure.walk :refer :all] [thi.ng.dstruct.core :as d] [thi.ng.xerror.core :as err])) fails spec: :shadow.build.ns-form/ns-form predicate: (cat :docstring (? string?) :meta (? map?) :clauses :shadow.build.ns-form/ns-clauses),  Extra input

thheller16:10:08

not exactly better but at least contains the file that caused it 😛

thheller16:10:54

the spec error is so terrible … its not even close to identifying the cause

thheller16:10:11

:refer :all is the issue

thheller16:10:58

maybe I just wrote the specs wrong … but this has to be one of the worst errors yet

thheller16:10:34

why are all those things macros? or rather why are there so many 😛

mhuebert16:10:09

that is much more helpful actually 🙂

thheller16:10:19

-- Syntax error -------------------

Value has extra input

  (... ... (:require
            [clojure.walk :refer :all]
            [thi.ng.dstruct.core :as d]
            [thi.ng.xerror.core :as err]))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

-- Relevant specs -------

:shadow.build.ns-form/ns-form:
  (clojure.spec.alpha/cat
   :ns
   '#{clojure.core/ns}
   :name
   clojure.core/simple-symbol?
   :docstring
   (clojure.spec.alpha/? clojure.core/string?)
   :meta
   (clojure.spec.alpha/? clojure.core/map?)
   :clauses
   :shadow.build.ns-form/ns-clauses)

-------------------------
Detected 1 error

mhuebert16:10:42

so lots of karsten’s stuff is designed for performance. that’s why all the macros.

thheller16:10:45

thats expound

mhuebert16:10:11

I think he has an ongoing complaint that clojure does not pay enough attention to performance ’cause lots of his work demands it.

mhuebert16:10:34

if the error is :refer :all how is that message relevant

thheller16:10:46

probably because of the way I structured my specs for the ns-form

thheller16:10:30

this org mode code is scary 😛

mhuebert16:10:13

Closure compilation failed with 1 errors
--- EXTERNS:/Users/MattPro/.m2/repository/cljsjs/d3/4.2.2-0/d3-4.2.2-0.jar!/cljsjs/d3/common/d3.ext.js:670
Object literal contains illegal duplicate key "scaleSequential", disallowed in strict mode

mhuebert16:10:32

i don’t remember seeing this before, trying an :advanced build in the re-frame demo

thheller17:10:40

was fixed a while ago it seems

mhuebert17:10:10

have you had an issue where shadow doesn’t recognize changed versions in shadow-cljs.edn?

mhuebert17:10:26

in updating d3 it didn’t download the new dep until i deleted target

thheller17:10:50

are you sure you restarted the server process?

mhuebert17:10:07

oh, no. i only started a new build.

thheller17:10:20

yeah I need to add a check for that

thheller17:10:53

new deps require a restart

mhuebert17:10:55

8 seconds vs 40 or 60 or 80 is a massive diff. for debugging advanced compiles

thheller17:10:16

still extern related bugs?

mhuebert20:10:12

i’m compiling a debugging-oriented thing in :advanced mode, so its just a bunch of weird things

thheller20:10:10

this day is full of weird things

thheller20:10:36

literally just including the example fixes the issue

thheller20:10:38

var onExit = require('signal-exit')
 
onExit(function (code, signal) {
  console.log('process exited!')
})

thheller20:10:42

NOTHING else

thheller20:10:50

it just works after this

thheller20:10:05

the process properly exits and everyone is happy

thheller20:10:14

I do not understand why

mhuebert20:10:42

Voodoo is the new math

thheller20:10:25

Shaun just ran into a unicode problem I have never seen before as well … and also didn’t happen when tested inside the shadow-cljs project

thheller20:10:47

I have no special unicode config in my project and the files were identical, verified by shasum

thheller20:10:47

guess its a good thing this day is almost over 😛