thheller / shadow-cljs

ClojureScript compilation made easy
https://github.com/thheller/shadow-cljs
Eclipse Public License 1.0
2.23k stars 173 forks source link

class shadow.undertow$fn$reify__11358 cannot be cast to class clojure.lang.Var$Frame #1160

Closed pesterhazy closed 2 weeks ago

pesterhazy commented 8 months ago

This exception happens rarely (about once a day) when running the dev env for our browser code

Exception in thread "async-dispatch-6" java.lang.ClassCastException: class shadow.undertow$fn$reify__11358 cannot be cast to class clojure.lang.Var$Frame (shadow.undertow$fn$reify__11358 and clojure.lang.Var$Frame are in unnamed module of loader 'app')
    at clojure.lang.Var.resetThreadBindingFrame(Var.java:103)
    at shadow.undertow$fn$reify__11358$fn__11482$state_machine__8296__auto____11521$fn__11524.invoke(undertow.clj:468)

I think this is related to websocket handling code

Reminiscent of https://github.com/thheller/shadow-cljs/issues/175

Full stacktrace here: stacktrace.txt

thheller commented 8 months ago

Which version mix is this? shadow-cljs? core.async? undertow?

My first, and really only, guess is some sort of version conflict. Or something else messing with classloaders.

This is the websocket handling loop which uses core.async.

If you have something to reliably reproduce this I'm happy to take a look, otherwise I'm afraid there is nothing much I can do.

pesterhazy commented 7 months ago
org.clojure/clojurescript 1.11.60  (EPL-1.0)
org.clojure/core.async 1.5.648  (EPL-1.0)
thheller/shadow-client 1.3.3  (EPL-1.0)
thheller/shadow-cljs 2.25.5  (EPL-1.0)
thheller/shadow-cljsjs 0.0.22  (EPL-1.0)
thheller/shadow-undertow 0.3.1  (EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0)
thheller/shadow-util 0.7.0  (EPL-1.0)
io.undertow/undertow-core 2.2.4.Final  (Apache-2.0)

I'll try and update core.async and see if that helps

thheller commented 7 months ago

Not necessary, this is the correct intended core.async version. The rest seems correct too.

That leaves anything messing with Classloaders, the JVM in general or maybe clojure itself such as tools.namespace. No real actual guess though from my end.