Fork me on GitHub
#shadow-cljs
<
2018-08-15
>
currentoor02:08:13

i’m using shadow-cljs from lein and when i do lein ubjerjar i get this

[2018-08-15 02:23:56.368 - INFO] duplicate resource cljs/compiler.cljc on classpath, using jar:file:/home/ec2-user/.m2/repository/org/clojure/clojurescript/1.10.339/clojurescript-1.10.339-slim.jar!/cljs/compiler.cljc over jar:file:/home/ec2-user/.m2/repository/org/clojure/clojurescript/1.9.946/clojurescript-1.9.946.jar!/cljs/compiler.cljc
but i made sure both package.json and project.clj have the same version of shadow-cljs, 2.5.1

lilactown04:08:49

it looks like you have clojurescript included twice

lilactown04:08:59

do you have clojurescript in your project.clj dependencies?

lilactown04:08:10

@currentoor also why are you creating an uberjar with your clojurescript dependencies in it?

currentoor04:08:12

@lilactown i don’t have clojurescript in project.clj deps

currentoor04:08:07

because in :uberjar :preptasks i have

:prep-tasks ["clean" ["clean"]
             "compile" ["with-profile" "cljs" "run" "-m" "shadow.cljs.devtools.cli" "release"
                        "main" "pos" "signon"]]}

currentoor04:08:06

is that a bad thing to do?

lilactown05:08:26

can you do a lein deps :treeand see if there’s duplicate CLJS being pulled in somewhere?

thheller07:08:10

@richiardiandrea the reload-deps! still doesnt quite work. need to find a better strategy for dealing with conflicts and actually making the added sources available to compilation. right now they are just added to the classpath and would require reloading the server first. I'll write an official introduction once I sorted out the kinks.

👍 4
thheller07:08:42

@currentoor you don't need to include anything from CLJS for a CLJ uberjar? in fact you want to avoid that to make it smaller. not sure how you end up with 2 versions of cljs on the classpath though.

currentoor23:08:06

it happens even if i do shadow release main instead of via uberjar prep task

currentoor23:08:13

and it only happens on the latest version of shadow-cljs

currentoor23:08:25

i’ll see if it can happen in a minimal repo

currentoor00:08:26

@U05224H0W so i was able to reproduce the issue in a minimal repo

currentoor00:08:58

this is the bare bones lein fulcro template, except i bumped shadow-cljs in package.json and project.clj

currentoor00:08:36

i logged what i saw in the readme

currentoor00:08:15

it does ultimately compile correctly but it still worries me that there are two versions of the compiler hanging around

currentoor00:08:41

@U0CKQ19AQ wrote the template used for this example, maybe he has an insight?

currentoor00:08:48

nothing looks suspect to me

currentoor00:08:50

Also I don’t see the warnings when running shadow-cljs in dev mode

tony.kay03:08:52

My only insight would be that when you bump versions of things it changes the dep graph, and that could pull crap in differently and cause all manner of issues.

tony.kay03:08:25

Compare a lein deps :tree on the working vs non-working @currentoor

thheller06:08:04

ah crap. I know why this happens ...

thheller06:08:05

I switched to using org.clojure/clojurescript "1.10.339" :classifier "slim" since the default release includes AOT classes which where clashing with shadow-cljs AOT classes

thheller06:08:32

didn't expect lein to treat this as an entirely different artifact

thheller07:08:13

yeah confirmed. tools.deps does the thing I expected but lein does not which l leads to the duplicated dep

currentoor17:08:56

what version of lein?

currentoor17:08:01

i’ll try updating lein, see if the latest version has this problem

currentoor17:08:27

damn i’m already at the latest

thheller17:08:54

yeah doesn't matter its in all lein versions

currentoor17:08:27

is it just an annoying warning for now, or could it actually cause problems in the build?

thheller17:08:55

probably yeah. I'll fix it eventually but not quite sure what to do yet

currentoor17:08:21

thanks for being so helpful, as usual! simple_smile

chrisetheridge08:08:18

what is the default directory that the SSL server serves? is it configurable?

thheller08:08:17

it is configured by any of the normal options. :http-root and such

thheller08:08:29

https doesn't have different options

chrisetheridge08:08:54

10:14:27.602 [main] DEBUG io.undertow - JDK9 ALPN not supported
java.lang.NoSuchMethodException: javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava.lang.String;)
	at java.lang.Class.getMethod(Class.java:1786)
	at io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:47)
	at io.undertow.protocols.alpn.JDK9AlpnProvider$1.run(JDK9AlpnProvider.java:43)
	at java.security.AccessController.doPrivileged(Native Method)
is this expected? i’m thinking it could do with dependency mismatches

thheller08:08:23

hmm never seen that

thheller08:08:47

open an issue. I can take a look later. no this is not expected.

richiardiandrea18:08:49

I am getting a weird

Circular dependency detected: testing.cljs.spec -> testing.cljs.spec
 (require 'testing.cljs.spec :reload)
when I do (require 'testing.cljs.spec :reload)

richiardiandrea18:08:04

and it looks like after that someting is messed up:

Circular dependency detected: testing.cljs.spec -> testing.cljs.spec

ClassCastException: 

thheller18:08:44

which ns were you in before the require?

richiardiandrea18:08:53

the parent of that one

thheller18:08:11

what is a parent?

richiardiandrea18:08:28

I mean A requires B, I was in A

thheller18:08:44

and B is testing.cljs.spec?

richiardiandrea18:08:12

yep, but I am now noticing that (unfortunately) it does not happen every time

richiardiandrea18:08:35

will try to repro it consistently

richiardiandrea18:08:01

I also see a

ClassCastException: clojure.lang.PersistentHashSet cannot be cast to clojure.lang.Associative
	clojure.lang.RT.assoc (RT.java:820)
	clojure.core/assoc--5218 (core.clj:191)
	clojure.core/assoc--5218 (core.clj:190)
	clojure.core/update (core.clj:6135)
	clojure.core/update (core.clj:6123)
	shadow.build.ns-form/eval10706/fn--10708 (ns_form.clj:372)
	clojure.lang.MultiFn.invoke (MultiFn.java:234)
	clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
	clojure.core/reduce (core.clj:6762)
	clojure.core/reduce (core.clj:6745)
	shadow.build.ns-form/parse (ns_form.clj:483)
	shadow.build.ns-form/parse (ns_form.clj:450)
	shadow.cljs.repl/make-repl-resource (repl.clj:76)
	shadow.cljs.repl/make-repl-resource (repl.clj:60)
	shadow.cljs.repl/repl-ns (repl.clj:304)
	shadow.cljs.repl/repl-ns (repl.clj:302)
	shadow.cljs.repl/process-read-result (repl.clj:415)
	shadow.cljs.repl/process-read-result (repl.clj:395)
	shadow.cljs.devtools.server.worker.impl/eval17297/fn--17300 (impl.clj:491)
	clojure.lang.MultiFn.invoke (MultiFn.java:234)
	shadow.cljs.devtools.server.util/server-thread/fn--17044/fn--17045/fn--17053 (util.clj:265)
	shadow.cljs.devtools.server.util/server-thread/fn--17044/fn--17045 (util.clj:264)
	shadow.cljs.devtools.server.util/server-thread/fn--17044 (util.clj:237)
	java.lang.Thread.run (Thread.java:748)
now after REPL reboot

richiardiandrea18:08:41

it was not showing up before

thheller18:08:01

I think you reported something like that before but never provided more details

richiardiandrea18:08:16

oh right, let me get rid of the namespaces line by line

thheller18:08:00

I need more overall details. just a random stacktrace doesn't give me anything to go on. its equally important to know what you did to get there

richiardiandrea18:08:25

yeah, well I am working on a macro in a .cljc file...

richiardiandrea18:08:31

so plenty of moving parts

richiardiandrea18:08:57

how do you usually deal with exceptions like this? I see the issue is closed but of course the problem is still there 😄

richiardiandrea18:08:15

just asking from a maintainer perspective

thheller18:08:27

I asked for more info. you didn't provide any. I close it after a while since there is nothing I can do.

richiardiandrea18:08:50

yep I saw that, just wondering whether it is best to leave open things like this, because other folks can pitch in...I maintain a couple of projects as well and wanted to ask your opinion 😄

thheller18:08:13

dunno still figuring this out myself. Getting a report with a basically blank exception with no additional details and no further movement despite a "Will try to investigate more" might just mean that it never happened again

richiardiandrea18:08:24

trying to repro, but cannot right now, will answer in that issue if I find anything more robust

thheller18:08:36

don't want to chase around anything blindly

richiardiandrea18:08:47

yes that's for sure

thheller18:08:58

hehe and as I say that I figure it out ...

richiardiandrea18:08:28

it looks like I had a compilation error in the macro file, that you can repro with

(defmacro a-macro
  []
  (let []
    `(println "test")))

richiardiandrea18:08:52

and the second time around, I get the ClassCastException

richiardiandrea18:08:02

I mean the second require around

thheller18:08:54

[5:0]~shadow.user=> (shadow/browser-repl)
[:browser-repl] Configuring build.
[:browser-repl] Compiling ...
[:browser-repl] Build completed. (134 files, 1 compiled, 0 warnings, 0.52s)
[5:1]~cljs.user=> JS runtime connected.
[5:1]~cljs.user=> (ns foo.bar)
nil
[5:1]~foo.bar=> (require 'demo.browser :reload)
nil
[5:1]~foo.bar=> (ns foo.bar (:require demo.browser))
[:result {:type :repl/error, :ex #error {
 :cause "clojure.lang.PersistentHashSet cannot be cast to clojure.lang.Associative"
 :via
 [{:type java.lang.ClassCastException
   :message "clojure.lang.PersistentHashSet cannot be cast to clojure.lang.Associative"
   :at [clojure.lang.RT assoc "RT.java" 820]}]
 :trace
 [[clojure.lang.RT assoc "RT.java" 820]
  [clojure.core$assoc__5138 invokeStatic "core.clj" 191]
  [clojure.core$assoc__5138 invoke "core.clj" 190]
  [clojure.core$update invokeStatic "core.clj" 6120]
  [clojure.core$update invoke "core.clj" 6108]
  [shadow.build.ns_form$fn__13691 invokeStatic "ns_form.clj" 372]
  [shadow.build.ns_form$fn__13691 invoke "ns_form.clj" 368]
  [clojure.lang.MultiFn invoke "MultiFn.java" 233]
  [clojure.lang.PersistentVector reduce "PersistentVector.java" 341]
  [clojure.core$reduce invokeStatic "core.clj" 6747]
  [clojure.core$reduce invoke "core.clj" 6730]
  [shadow.build.ns_form$parse invokeStatic "ns_form.clj" 483]
  [shadow.build.ns_form$parse invoke "ns_form.clj" 450]
  [shadow.cljs.repl$make_repl_resource invokeStatic "repl.clj" 76]
  [shadow.cljs.repl$make_repl_resource invoke "repl.clj" 60]
  [shadow.cljs.repl$repl_ns invokeStatic "repl.clj" 304]
  [shadow.cljs.repl$repl_ns invoke "repl.clj" 302]
  [shadow.cljs.repl$process_read_result invokeStatic "repl.clj" 415]
  [shadow.cljs.repl$process_read_result invoke "repl.clj" 395]
  [shadow.cljs.devtools.server.worker.impl$fn__19853 invokeStatic "impl.clj" 491]
  [shadow.cljs.devtools.server.worker.impl$fn__19853 invoke "impl.clj" 455]
  [clojure.lang.MultiFn invoke "MultiFn.java" 233]
  [shadow.cljs.devtools.server.util$server_thread$fn__19628$fn__19629$fn__19637 invoke "util.clj" 265]
  [shadow.cljs.devtools.server.util$server_thread$fn__19628$fn__19629 invoke "util.clj" 264]
  [shadow.cljs.devtools.server.util$server_thread$fn__19628 invoke "util.clj" 237]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.lang.Thread run "Thread.java" 844]]}}]

richiardiandrea18:08:46

seems similar 😄

thheller18:08:27

:reload handling is completely weird. don't know how I intended that to work in the first place 😛

richiardiandrea18:08:18

well I have just introduced that key binding in cider so I guess nobody was really using it 😛

thheller18:08:25

nah the problem only appeared if you did the (ns ...) after calling require :reload

thheller18:08:49

since ns is additive in the REPL it had trouble merging the flags, thats all