This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-18
Channels
- # announcements (26)
- # beginners (107)
- # calva (26)
- # cider (55)
- # clj-kondo (7)
- # clojure (115)
- # clojure-europe (6)
- # clojure-houston (3)
- # clojure-italy (4)
- # clojure-nl (16)
- # clojure-norway (1)
- # clojure-uk (42)
- # clojuredesign-podcast (3)
- # clojurescript (47)
- # clojutre (4)
- # cursive (7)
- # datomic (75)
- # fulcro (1)
- # graalvm (3)
- # graphql (16)
- # jobs (1)
- # jobs-discuss (13)
- # keechma (1)
- # leiningen (19)
- # luminus (5)
- # off-topic (33)
- # pathom (16)
- # re-frame (76)
- # reitit (4)
- # ring (5)
- # shadow-cljs (86)
- # spacemacs (52)
- # tools-deps (43)
- # vim (7)
- # yada (1)
When I run npx shadow-cljs watch stories
I get the following error:
npx: installed 91 in 3.066s
shadow-cljs - config: /Users/.../shadow-cljs.edn cli version: 2.8.52 node: v10.16.3
shadow-cljs - connected to server
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:436).
shadow.cljs.devtools.cli
I'm unsure what is causing this error? Is it shadow-cljs related or Storybook etcI'm guessing you are running an embedded server that you started via (shadow.cljs.devtools.server/start!)
?
if so you must also (:require [shadow.cljs.devtools.cli])
in the ns that starts the server to ensure that it is loaded
[shadow.cljs.devtools.cli]
[shadow.cljs.devtools.api :as shadow-cljs]
[shadow.cljs.devtools.server :as shadow-server]
Then get No config for build "stories" found. Build id required.
- It must not be picking up my stories
config in shadow-cljs.edn
{:lein true
:builds {:frontend {:target :browser
:output-dir "resources/app/public/js"
:asset-path "/js"
:modules {:main {:entries [frontend.core]}}}}
:stories {:target :npm-module
:output-dir "resources/app/public/js"
;; storybook already handles all reloading
:devtools {:enabled false}}}}
properly indented you get
{:lein true
:builds {:frontend {:target :browser
:output-dir "resources/app/public/js"
:asset-path "/js"
:modules {:main {:entries [frontend.core]}}}}
:stories {:target :npm-module
:output-dir "resources/app/public/js"
;; storybook already handles all reloading
:devtools {:enabled false}}} }
Ah, sorry, still getting the hang of the syntax. There's an Atom Paredit so will look into that
Storybook have updated their story syntax, once I get this up and running I could update your example code?
hey @thheller, some of my devs are seeing the "too many open files" error during shadow builds... they have large ulimit -n
( 30720
, which seems like it should be enough). blatting their .shadow-cljs
directory seems to fix the problem temporarily, but it still seems to crop up after a while. were on cli version: 2.8.52 node: v12.5.0
(which is later than https://github.com/thheller/shadow-cljs/issues/261 fix)... any ideas ?
it is likely creating too many cache files? which means you are accessing too many npm files maybe?
we can make a copy next time it happens...
but yeah .shadow-cljs
is just cache, which will just be written again so it should end up at the same values after one build
find .shadow-cljs | wc
is returning 7118
for me atm... well within my 32k ulimit
last time I checked there were no file leaks anymore. so in case it happens again try to find out which files are open
thats only the cache files though. it'll still have the files from node_modules
open
anyway, i've given instructions to keep .shadow-cljs
next time it happens and get an lsof
dump
we don't run several builds in parallel - we do have a bunch of different builds and we do feed --config-merge
EDN to those builds
here's an lsof
dump @thheller - almost all the files are .jar
s from ~/.m2
there aren't any source files from the project directory, or cache files from the .shadow-cljs
directory there
yep - there are definite repeats
every jarfile i've looked at so far is open twice
oh, wow - promesa-1.9.0.jar
is open 142 times!
and reagent-0.8.1.jar
362 times
is it shadow opening jarfiles, or is that down to the cljs compiler ?
hmm... well something is going awry - does each run of the compiler create a new classloader perhaps ?
i can't remember whether random access in a zipfile makes any sense and thus whether it would make sense for a classloader to hold jars open to load future class requirements from
presumably this is an issue of shadow server mode though, and restarting the shadow server should make everything good
we'll try that next time it happens
Hey @thheller! Not quite sure how to phrase this question/concern but I’ve been having quite a few very cryptic and laborious-to-isolate errors and I wonder whether shadow-cljs could report them in a more user-friendly or easy-to-debug way. I’ve been able to work through them with a mix of 1) (set! (.-onerror js/document) (fn [...] (log-pretty-error ...)))
, 2) bisecting the code by commenting out parts till I get to the error, and 3) just restarting the build. 2) and 3) have proven particularly time-consuming. Here’s an example of something (I still don’t know what it is — have to do good ol’ option 2 and 3 till I figure out) :
[:local.client.search] Compiling ...
[:local.client.search] Build failure:
ClassCastException: java.lang.String cannot be cast to clojure.lang.Named
clojure.core/namespace (core.clj:1597)
clojure.core/namespace (core.clj:1597)
shadow.build.compiler/write-cached-cljs-resource/spec-filter-fn--11841 (compiler.clj:707)
shadow.build.compiler/write-cached-cljs-resource/fn--11844 (compiler.clj:713)
clojure.core/fn--8429/fn--8431 (core.clj:6840)
clojure.core.protocols/iter-reduce (protocols.clj:49)
clojure.core.protocols/fn--8140 (protocols.clj:75)
clojure.core.protocols/fn--8140 (protocols.clj:75)
clojure.core.protocols/fn--8088/G--8083--8101 (protocols.clj:13)
clojure.core/reduce (core.clj:6828)
clojure.core/fn--8429 (core.clj:6830)
clojure.core/fn--8429 (core.clj:6830)
clojure.core.protocols/fn--8167/G--8162--8176 (protocols.clj:175)
clojure.core/reduce-kv (core.clj:6856)
clojure.core/reduce-kv (core.clj:6847)
shadow.build.compiler/write-cached-cljs-resource (compiler.clj:711)
shadow.build.compiler/write-cached-cljs-resource (compiler.clj:677)
shadow.build.compiler/maybe-compile-cljs (compiler.clj:832)
shadow.build.compiler/maybe-compile-cljs (compiler.clj:762)
shadow.build.compiler/par-compile-one (compiler.clj:895)
shadow.build.compiler/par-compile-one (compiler.clj:850)
shadow.build.compiler/par-compile-cljs-sources/fn--11897/iter--11919--11923/fn--11924/fn--11925/fn--11926 (compiler.clj:968)
clojure.core/apply (core.clj:665)
clojure.core/with-bindings* (core.clj:1973)
clojure.core/with-bindings* (core.clj:1973)
clojure.core/apply (core.clj:669)
clojure.core/bound-fn*/fn--5749 (core.clj:2003)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
java.lang.Thread.run (Thread.java:748)
[:local.client.search] Compiling ...
[:local.client.search] Build failure:
ClassCastException:
[:local.client.search] Compiling ...
[:local.client.search] Build failure:
ClassCastException:
I’m happy to post more of these sorts of things as I come across them. Had quite a few yesterday but I worked through them.
(By the way those last ClassCastException
s have no stack trace and it’s not obvious whether they relate to the first one)
^^^ Solved this particular issue by method #3. Doesn’t fix the crypticness but good to know it’s at least an available option.the plot thickens. after restarting there are only 546 open jarfiles, but the build still fails with too-many-open-files - so it looks like the open jarfiles are not the root cause of the problem. whatever is the cause is not yet clear - there are only 2044 files in the .shadow-cljs
directory
currently trying to capture an lsof
dump during compilation, since perhaps whatever open files are causing the issue are getting closed after compilation fails
@alexandergunnarson that error indeed sucks but I have never seen that so kinda not sure whats happening
that part of the code deals with caching specs. do you do any black magic with spec? custom implementations or so?
Interesting; yeah now I’m seeing the spec-filter-fn
I do a few black magics with it 🙂
I think this was a case of for whatever reason I was defining a spec incorrectly (e.g. transposing docstring with keyword name) and it got swapped into the spec cache
So I have a slightly custom s/def
that does like (s/def :whatever/spec-name "docstring" {:meta-stuff "if you want"} some-spec)
I was erroneously doing (s/def "docstring" :whatever/spec-name)
And I think that bad data got swapped in
Makes sense! Well anyway I will keep you posted of similarly odd/cryptic errors I get haha
Maybe there’s a pattern in terms of usability enhancements
well if you do stuff that no one else has done before there likely aren't good error messages there 😉
Heh good point 😉
https://github.com/thheller/shadow-cljs/commit/356289b3ae44753099d9cbe5f79765af5cdf69e2
Okay cool haha — thank you thank you! If you were a customer support person I’d rate you a 12/10!
Too bad there’s not much money in open source… even if it is an awesome tool… ah well, Patreon
+1 on that: thheller provides tons of great support here. https://www.patreon.com/thheller for those who want to show a little love