lsp

2026-01-08T17:45:46.720979Z

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 fine

ericdallo 2026-01-08T18:02:38.958969Z

Oh, 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

ericdallo 2026-01-08T18:02:49.132099Z

Any suggestion to debug that @borkdude?

borkdude 2026-01-08T18:40:20.081749Z

is that the whole stack trace?

2026-01-08T18:46:54.404269Z

the whole is very long, let me capture it some how

borkdude 2026-01-08T18:47:31.768149Z

I wonder how it gets into a stackoverflow

2026-01-08T18:53:55.896799Z

https://gist.github.com/hiredman/4a77f3f8a4211d02e5c98b31b1b97277 interestingly the atom part of the stack doesn't appear to repeat

2026-01-08T18:55:25.107609Z

huh, I bet this is connected to a hook for one of our macros somehow

borkdude 2026-01-08T18:56:12.648579Z

analyze_clojure_string_replace

borkdude 2026-01-08T18:56:19.095039Z

seems to be repeated

2026-01-08T18:58:25.378629Z

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

borkdude 2026-01-08T18:59:00.417909Z

hmm interesting

borkdude 2026-01-08T19:04:04.941989Z

what's the depth of that thing?

2026-01-08T19:14:48.622429Z

the body isn't deep, a single -> containing hundreds of calls to str/replace

2026-01-08T19:15:11.263539Z

I haven't look at our hooks yet to see what we have for the macro

borkdude 2026-01-08T19:15:53.154459Z

-> is actually expanded in clj-kondo so a -> with hundres of calls would be hundreds deep

2026-01-08T19:16:35.223019Z

ah, interesting, let me try without our macro and just with a large ->

2026-01-08T19:18:33.092539Z

yeah, it is just a large -> that causes it, I wonder why it isn't a problem in the project it was extracted from

2026-01-08T19:27:18.127839Z

hah, it does fail the same way in the original project, I was just doing it wrong

borkdude 2026-01-08T19:28:56.806119Z

:-)