I have a project where clojure-lsp works fine, and I am taking some code in it and spinning it out into a new project, and in the new project clojure-lsp listen just sort of hangs (no output ever, no cpu usage). clojure-lsp dumpalso hangs, but before it does it prints out a stack overflow
[ 20%] Analyzing project files Exception in thread "pool-5-thread-2" java.lang.StackOverflowError
at org.graalvm.nativeimage.builder/com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.newStackOverflowError0(StackOverflowCheckImpl.java:348)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.newStackOverflowError(StackOverflowCheckImpl.java:344)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.throwNewStackOverflowError(StackOverflowCheckImpl.java:324)
at clojure.lang.Atom.swap(Atom.java:79)
at clojure.core$swap_BANG_.invokeStatic(core.clj:2372)
at clojure.core$swap_BANG_.doInvoke(core.clj:2362)
at clojure.lang.RestFn.invoke(RestFn.java:500)
at clj_kondo.impl.namespace$reg_used_alias_BANG_.invokeStatic(namespace.clj:329)
at clj_kondo.impl.namespace$reg_used_alias_BANG_.invoke(namespace.clj:327)
at clj_kondo.impl.namespace$resolve_name.invokeStatic(namespace.clj:711)
at clj_kondo.impl.namespace$resolve_name.invoke(namespace.clj:675)
at clj_kondo.impl.analyzer$analyze_call.invokeStatic(analyzer.clj:2385)
at clj_kondo.impl.analyzer$analyze_call.invoke(analyzer.clj:2341)
at clj_kondo.impl.analyzer$analyze_expression_STAR__STAR_.invokeStatic(analyzer.clj:3245)
at clj_kondo.impl.analyzer$analyze_expression_STAR__STAR_.invoke(analyzer.clj:3056)
at clj_kondo.impl.analyzer$analyze_children$fn__27117.invoke(analyzer.clj:79)
at clojure.core$map_indexed$fn__8676$fn__8677.invoke(core.clj:7490)
at clojure.core.protocols$fn__8275.invokeStatic(protocols.clj:167)
at clojure.core.protocols$fn__8275.invoke(protocols.clj:123)
running clj-kondo --lint works just fineOh, interesting, a stack overflow in clj-kondo when registering a alias We pass more flags to clj-kondo than clj-kondos default some may be doing that
Any suggestion to debug that @borkdude?
is that the whole stack trace?
the whole is very long, let me capture it some how
I wonder how it gets into a stackoverflow
https://gist.github.com/hiredman/4a77f3f8a4211d02e5c98b31b1b97277 interestingly the atom part of the stack doesn't appear to repeat
huh, I bet this is connected to a hook for one of our macros somehow
analyze_clojure_string_replaceseems to be repeated
yeah, we have an obnoxiously long body being passed to one of our macros, and when I comment out part of the body it stops stacking
hmm interesting
what's the depth of that thing?
the body isn't deep, a single -> containing hundreds of calls to str/replace
I haven't look at our hooks yet to see what we have for the macro
-> is actually expanded in clj-kondo so a -> with hundres of calls would be hundreds deep
ah, interesting, let me try without our macro and just with a large ->
yeah, it is just a large -> that causes it, I wonder why it isn't a problem in the project it was extracted from
hah, it does fail the same way in the original project, I was just doing it wrong
:-)