Fork me on GitHub
#shadow-cljs
<
2019-01-05
>
currentoor20:01:50

I’m trying to get CI tests working, followed the instructions in the manual but about 50% of the time my CI fails with this message

#!/bin/bash -eo pipefail
npx karma start --single-run
05 01 2019 20:23:40.760:WARN [watcher]: Pattern "/home/circleci/project/target/ci.js" does not match any file.
05 01 2019 20:23:40.766:INFO [karma-server]: Karma v3.1.4 server started at 
05 01 2019 20:23:40.766:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
05 01 2019 20:23:40.770:INFO [launcher]: Starting browser ChromeHeadless
05 01 2019 20:23:41.059:INFO [HeadlessChrome 71.0.3578 (Linux 0.0.0)]: Connected on socket -fOAgM3QhFtvOxByAAAA with id 55473730
HeadlessChrome 71.0.3578 (Linux 0.0.0) ERROR
  {
    "message": "ReferenceError: shadow is not defined\n    at eval (eval at <anonymous> (/home/circleci/project/node_modules/karma-cljs-test/adapter.js:6:7), <anonymous>:1:1)\n    at ContextKarma.start (/home/circleci/project/node_modules/karma-cljs-test/adapter.js:6:7)\n    at ContextKarma.loaded ()\n    at ",
    "str": "ReferenceError: shadow is not defined\n    at eval (eval at <anonymous> (/home/circleci/project/node_modules/karma-cljs-test/adapter.js:6:7), <anonymous>:1:1)\n    at ContextKarma.start (/home/circleci/project/node_modules/karma-cljs-test/adapter.js:6:7)\n    at ContextKarma.loaded ()\n    at "
  }


Exited with code 1

currentoor20:01:12

anyone ever deal with that?

currentoor20:01:17

it runs fine locally

currentoor20:01:18

adding an ls before the karma command shows that the expected file target/ci.js is missing when the test fails

currentoor20:01:44

also i noticed on a successful run shadow-cljs compile ci-tests prints [:ci-tests] Build completed. whereas on an unsuccessful build it doesn print that, however both return exit code 0

currentoor20:01:17

Any idea why it would fail to finish compiling but not return an error?

tony.kay21:01:00

I’m sort of guessing the package.json might have weird dependencies…some conflict that causes erratic resolution

tony.kay21:01:16

not sure why that causes a failure to emit a file though

tony.kay21:01:28

but deps are like that…when they get screwed up, weird things can happen

thheller21:01:01

unsuccessful builds should not exit with 0 but maybe the handling for that got messed up

thheller21:01:20

I'll try to confirm

tony.kay22:01:06

I tried a difference ci image and it is working for now…goign to hit it a few more times and see if it fails. I confirm what @U09FEH8GN is seeing (we’re working on same project): it isn’t printing an error on build…just isn’t emitting code

tony.kay22:01:25

Was using tools-deps image, now using openjdk8-tools-deps image (which is newer)

tony.kay22:01:16

@U05224H0W just FYI. On the failing cases it was showing this: `

tony.kay22:01:33

shadow-cljs - config: /home/circleci/project/shadow-cljs.edn  cli version: 2.7.10  node: v10.15.0
shadow-cljs - starting via "clojure"
WARNING: requiring-resolve already refers to: #'clojure.core/requiring-resolve in namespace: datomic.common, being replaced by: #'datomic.common/requiring-resolve
NPM dependency "reakit" has installed version "0.15.13"
"^0.11.1" was required by jar:file:/home/circleci/.m2/repository/fulcrologic/fulcro-incubator/0.0.24/fulcro-incubator-0.0.24.jar!/deps.cljs
NPM dependency "react-icons" has installed version "3.2.2"
"^2.2.7" was required by jar:file:/home/circleci/.m2/repository/fulcrologic/fulcro-incubator/0.0.24/fulcro-incubator-0.0.24.jar!/deps.cljs
[:ci-tests] Compiling ...
added 104 packages from 62 contributors and audited 1976 packages in 2.047s
found 0 vulnerabilities

tony.kay22:01:42

All BUT the compile completed

tony.kay22:01:52

I’ve built it twice now on the new image without error

tony.kay22:01:13

now the output includes the additional line:

[:ci-tests] Build completed. (949 files, 814 compiled, 0 warnings, 23.88s)

tony.kay23:01:30

More info. The container did not fix it after all 😞. So, I ran compiler with -v in CI and it looks like it is just stopping mid-compile…here are the last few lines:

<- Cache write: ucv/lib/form_encoding.cljc (7 ms)
-> Compile CLJS: ucv/lib/uism_extensions.cljc
-> Compile CLJS: ucv/ui/alert_test.cljs
-> Compile CLJS: ucv/ui/order_flow/shared.cljs
<- Cache write: ucv/util.cljc (11 ms)
<- Compile CLJS: ucv/ui/order_flow/shared.cljs (10 ms)

thheller00:01:59

seems like it gets stuck compiling. do you run multiple builds concurrently? (I removed that since it was causing problems, depends on which version you are running though)

thheller00:01:43

ah CI ... your process likely gets killed by OOM killer

thheller00:01:05

try to set :jvm-opts ["-Xmx2G"] or however much your CI machine allows

thheller00:01:12

not sure I can control the error code if OOM killer terminates it

tony.kay19:01:54

weird that is is irratic, but yeah, I’ll try that

currentoor20:01:16

where do those :jvm-opts go? inside the build options along with stuff like :target and :compiler-options?

thheller20:01:37

top-level in shadow-cljs.edn

thheller20:01:43

not sure if its actually the OOM killer but this was an issue with CI previously with very similar behaviour

thheller20:01:52

so "hoping" that its just that 😉

currentoor20:01:59

seems plausible simple_smile

currentoor20:01:04

it passed the first time

currentoor20:01:15

i’m going to run it a few more times

thheller20:01:52

are you on circleci by any chance?

thheller20:01:22

ah that makes it more likely I guess. It was killing when the proc reached 3gb IIRC

currentoor20:01:38

and we’re on the free tier

thheller20:01:39

which it can reach on larger builds if not limited

currentoor20:01:05

it’d be nice if the OOM killer was a little more transparent

currentoor20:01:16

so the build succeeded the second time too!

thheller20:01:47

yeah I can't remember what it took to make that visible. it was logged somewhere obscure

thheller20:01:52

maybe syslog? can't remember

currentoor20:01:12

worked the third time also

currentoor20:01:17

i think that was it

currentoor20:01:24

thank you so much!

👍 5