Fork me on GitHub
#lsp
<
2023-04-18
>
snoe19:04:40

Having trouble analyzing metabase on a clojure-lsp master debug-cli build (was running a build from last year fine). Running into OOM Error saving db cache and it seems to freeze everything. This happens through nvim and the cli with ~/dev/clojure-lsp/clojure-lsp --verbose diagnostics Cleared caches, tried changing the cli :native jvm opts to 4g but to no avail. Any ideas? Anyone want to try it? These are the cli logs

ericdallo19:04:33

Hum, maybe could be related with new java analysis we now have java-member-definitions

snoe19:04:19

@UKFSJSM38 I'm trying 2023.02.27-13.12.12

ericdallo19:04:54

I think some release from this year added the java-member-definitions from ASM

ericdallo19:04:01

try disabling the java feature first

ericdallo19:04:05

{:java false}

👀 2
ericdallo19:04:05

we should probably improve the kondo java analysis call to be in batch like we do for clojure analysis

ericdallo20:04:39

it's interesting how the OOM happens during the save to transit cache and not kondo call, maybe there is somthing we can do there to improve memory usage

snoe20:04:46

hrm ok so :java false made a small difference. 2022.07.24-18.25.43 works fine. 2023.02.27-13.12.12freezes? but does not produce an error, it was stuck at this 50% for ~5 minutes then died without a message (the old version says "Finding diagnostics... No diagnostics found!")

snoe20:04:52

I'm guessing it's still OOM but being swallowed

ericdallo20:04:05

Yeah, I think so we had so many changes since july 2022 😅

snoe20:04:54

I'll do some bisescting

ericdallo20:04:54

we had keywords, edn analysis and more stuff, but I suppose there are other people using more recent clojure-lsp via metabase?

snoe20:04:08

yeah, but not the debug-cli

ericdallo20:04:17

yeah, native-image works and JVM not is weird

snoe20:04:42

Yeah double checked, and the homebrew release does work. There is a huge wait time between 50% analysis and spitting out the result tho unlike the old release that gradually climbed to 100%. Maybe in the switch to bb debug-cli we just lost a jvm opts for heap space somewhere? 2022.10.05-16.39.51 fails w screenshot (only tag that didn't do that. 2022.09.01-15.27.31 works

ericdallo20:04:16

Hum, maybe, we had considerable redactors since July release that changed to use bb for everything I think

ericdallo20:04:06

Checking the changelog, I think that release of Oct added the index by URI, which is made in kondo.clj normalize function, maybe we could check if there is some improvement there as well

dpsutton20:04:38

@U0BUV7XSA try on the branch from https://github.com/metabase/metabase/pull/30202/files There was an issue relating to clj-kondo’s parsing that caught us out. This should hopefully fix it. I’ve been on the january release as i haven’t spent the time to fix it but cam just fixed it

snoe20:04:36

@U11BV7MTK i did, it's a different issue w the build

👍 2
Braden Shepherdson14:04:55

I'm seeing perhaps the same issue. I'm running a bb debug-cli build from nvim and get an error that Stack trace of root exception is empty on startup which I suspect is the same OOM but the message isn't getting through. (I've also got the Metabase-specific fix Dan alluded to above.)

ericdallo16:04:57

Only in metabase @UCY0GT0QM?

ericdallo16:04:33

maybe metabase is the first project to reach "the limit" of analysis without need to increase heap, since 2022 july, we had lots of improvements and feature on clojure-lsp which require more analysis, like keywords, java stuff etc, so we could check if there is a improvement for this in clojure-lsp to avoid that much memory

Braden Shepherdson17:04:42

yeah, I'm only seeing this in Metabase currently. that is a big codebase with a big depset, so maybe it really is memory exhaustion. on the other hand, it's possible there's an analysis bug that's causing a runaway analysis.

👍 1
Braden Shepherdson17:04:18

let me try a debug-cli build at master on another codebase and see if it works there.

ericdallo17:04:28

so I guess it's related to analysis size indeed, we could try to understand what is making clojure-lsp use that much analysis, not blowing in kondo is already a good start since is what we had issues in the past, so probably something we could do on clojure-lsp side like avoid having a whole vector of items and do things lazy and things like that

Braden Shepherdson17:04:06

I'm trying a tweaked build to set -Xmx4g and see what happens on Metabase.

ericdallo17:04:13

there is even a TODO from @U07M2C8TT , maybe he has some clue :)

Braden Shepherdson18:04:01

for the record it is working at 4g after a lengthy startup 🙂

jacob.maine18:04:24

Not sure I can help… it looks like snoe’s OOM occurred in the assoc on https://github.com/clojure-lsp/clojure-lsp/blob/4448954d9fecff4b777abbcdb4c606305a60ff27/lib/src/clojure_lsp/kondo.clj#L153. That assoc doesn’t look like it would allocate much itself, so presumably we were right on the border of being out of heap already. As usual with OOMs, the real problem is probably elsewhere

😔 1
👍 1
thanks 1