Open dos65 opened 5 months ago
This might have been related to my change with compilers :thinking: They are maybe not removed properly :/ I will take a look next week
I am facing also this issue when I run tests within vscode. I've created a public github repo where the issue can be reproduced:
I think the two are not actually related, thanks for the reproduction @kostaskougios, it's actually something I was meaning to look into.
@dos65 Are you able to reproduce it consistently? Does it happen also on latest nightly?
@kostaskougios how many time do you run it? It doesn't seem to run out of memory for me :thinking:
@kostaskougios how many time do you run it? It doesn't seem to run out of memory for me 🤔
In my box it starts bloop.Server with 3GB of ram. It takes several runs to run out of memory, about 8 runs but lets say in 10-20 runs it should definatelly run out of mem with 3GB. But you can see that it piles up memory if you run jconsole and click the "memory" tab. Memory usage increases and even if you run a "GC" it doesn't go down (by much), eventually more and more memory is used until it runs outofmem.
@kostaskougios I moved your issue into https://github.com/scalameta/metals/issues/6521, since I don't think the two are related
Btw. any chance to get a heap dump from the process to see what is taking up the memory?
I split the issue with tests into another issue, but I am struggling to see why the original issue raised by @dos65 happened. I imagine that we could cause it if we try to calculate references for all modules with presentation compiler, but that was not available on the last release.
Does this happen also on newest snapshots? Does the number of pc threads raise over the number of modules? How often does this happen?
I'm not sure if this is the same bug. My MacBook + VSCode + Metals gets blocked pretty often (once in an hour) when editing in complicated code spaces where compilation, type inference is difficult. I have to restart my VSCode.
This is from my metals log:
...
normal logs
...
2024.06.27 15:59:07 INFO time: code lens generation in 2.68s
2024.06.27 15:59:09 INFO time: code lens generation in 2.93s
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pool-1-thread-10"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-15"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "bsp-server-to-client"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-13"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "bsp-server-to-client"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-7"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-5"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pool-7-thread-3"
Should I submit a new issue? Sorry that I can't contribute more details. I don't know where to look. This is only since I upgraded to latest metals 1.3.2.
Are you at any point searching for references? Would you be able to catch stacktraces?
Did you try bumping -Xmx? It's only 1GB by default
I changed "metals.bloopJvmProperties": ["-Xmx4G"]
. I'll get back if the issue persists.
I would change metals.serverProperties
instead
@kovacshuni, https://github.com/scalameta/metals/pull/6539 might have been a fix for your issue, so another thing you could do is change metals server version to the newest snapshot and checking if that helps
Describe the bug
No idea how to reproduce but I was working with scala2 code and after some period Metals stopped responding and then crashed with OOM.
I took a heap dump from this process. MAT suggest to look at
MetalsGlobalThread
as there are a lot of intancse of it and they take 75% of memory:The same but in
dominator-tree
view:Expected behavior
No response
Operating system
Linux
Editor/Extension
VS Code
Version of Metals
v1.3.1
Extra context or search terms
No response