Fork me on GitHub
#hyperfiddle
<
2023-03-04
>
nakkaya14:03:10

Hi guys, after following the above instructions to bump to new release. Everything works in dev mode as before however something is broken in my uberjar. I am getting the following, is there a way to debug what is causing it? (I get no errors on the server side.)

šŸ‘€ 2
āœ… 2
xificurC14:03:23

Is this an advanced optimized build?

nakkaya14:03:21

no, no optimization defined, just a regular release.

Geoffrey Gaillard14:03:36

Optimization :advanced is the default for a regular release.

xificurC14:03:13

You can try building with latest master if you want advanced optimizations, we landed a fix

nakkaya14:03:00

dont really need advanced optimization for now I can make due with simple. Previously it broke when I added advanced optimization removing it fixed it at the time. Will try with simple optimization.

šŸ‘ 2
nakkaya14:03:39

yeap that did the trick. thanks @U09FL65DK @U2DART3HA

Michael W18:03:10

I just updated to master and it broke my multi-player. I was doing this to get a session-id for each visitor to the site into an atom that I'm watching:

(e/server
  (e/on-mount #(swap! !players assoc-in [session-id :status] :idle))
  (e/on-unmount #(swap! !players dissoc session-id)))
But now e/on-mount seems to be gone. How to assoc the session-id into the watched atom now without e/on-mount?

āœ… 2
Michael W18:03:55

Ok read that and it's fixed now. Thanks.

šŸ‘ 2
Dustin Getz18:03:00

idea: a multiplayer pinball game like https://thegeez.net/2023/03/01/pinball_scittle.html where each time you lose a ball, your opponent gets an extra ball, and every 30 seconds the speed increases. code is here: view-source: and i'd probably use SVG; use e/system-time-secs for physics equations

nakkaya18:03:08

When I do (main) after running cider-jack-in I get random errors, works most of the time but say 1 in 5 times I would get a different error. Running in dev without a repl works all the time. Error changes from time to time but the latest one I got is ,

user> (main)
Starting Electric compiler and server...
Execution error (IllegalAccessError) at clojure.tools.analyzer.passes.jvm.infer-tag/eval13126$loading (infer_tag.clj:9).
annotate-tag does not exist

šŸ‘€ 2
āœ… 2
Dustin Getz18:03:43

are shadow and electric-server running the same shared JVM?

Dustin Getz18:03:54

(do you understand the question?)

nakkaya18:03:25

Can you expand a little bit? I am launching via cider-jack-in which uses /usr/local/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "1.0.0"} cider/cider-nrepl {:mvn/version "0.30.0"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}}}' -M:dev:cider/nrepl

Dustin Getz18:03:53

two things can cause unreliable programs when hot code reloading: ā€¢ when cljs rebuilds but the server doesn't reload ā€“ to solve this, make sure shadow-cljs and your repl are running from the same JVM, as they are set up in the starter app repo

nakkaya18:03:32

checking the number of java processes running after jack in its one.

šŸ‘€ 2
Dustin Getz18:03:48

ā€¢ an open tab from a stale frontend version currently will auto-reconnect to the server, and the client/server programs therefore will mismatch. Workaround by reloading the page after every incremental build. And make sure you don't have a bunch of old tabs open, you'll see error spam in the server log due to this

nakkaya18:03:41

btw this is not happening when its reloading, it happens on launch only once I get it to launch everything works as advertised

šŸ‘€ 2
nakkaya18:03:03

crash happens on the JVM side not on the client side.

Dustin Getz18:03:28

the client is sending messages to the server that the server tries to interpret, so a stale client can cause server problems

Dustin Getz18:03:06

If it's not that, then i suspect a tooling/workflow issue, one of the emacs users will be able to support you

Dustin Getz18:03:46

One thing to try is to just run the entrypoint from the command line, shadow exposes nrepl and you can connect via nrepl

Dustin Getz18:03:27

when developing Electric Clojure apps, you don't really eval buffers, you save the file, and the shadow compiler picks up the change and reloads everything

Dustin Getz18:03:33

(thus keeping frontend and backend in sync)

Dustin Getz18:03:01

but you did say this is not a hot code reloading problem

Dustin Getz18:03:29

oh, you're on laatest, right? v2-123

nakkaya18:03:50

hmm maybe that is the cause I am launching multiple repls one from shadow, one from emacs. > but you did say this is not a hot code reloading problem yes once it starts it keeps working no issues. > oh, you're on laatest, right? v2-123 also yes > (thus keeping frontend and backend in sync) For front end code I let electric do its thing, but it is much faster to try things in repl that support app logic. (testing db functions etc. without filling in all the forms.) I use repl for non electric stuff.

Michael W18:03:18

you need to have emacs jack-in to the shadow repl instead of running 2 repls. On calva it will pick up the .shadow-cljs/nrepl.port file and jack-in to the shadow repl. Not sure how to configure that in emacs.

nakkaya18:03:48

> shadow exposes nrepl and you can connect via nrepl Just chcked this and it works as expected, I missed that it launched. thanks for the help guys.

šŸ‘ 2
Dustin Getz18:03:45

for the record, ordinary clojure REPL workflows are 100% fine for ordinary clojure parts of your project. it is only changes to e/def and e/defn that need to be synchronized. if you change electric code, you must flush to disk

šŸ‘ 4
vincent23:03:49

Hi, so if i want to make an uberjar should i wait for the official instructions? x)

āœ… 2
Dustin Getz23:03:30

probably yes, coming soon .. we have them already actually but want to test a little more

Dustin Getz23:03:16

there is a theoretical possible issue related to automatic websocket reconnection that we want to understand before people do this

āœ… 2
vincent18:03:41

ok no prob

vincent18:03:54

i can set up a landing page for my app using other things for now (rum)

Dustin Getz18:03:26

yeah definitely do not use this for a landing page

Dustin Getz18:03:00

each session has a websocket, it's not free on the server

Dustin Getz19:03:29

the above issues are resolved in master now, starter-app is updated with dockerfile and CI/CD to http://fly.io

āš” 1