Skip to content

Set the vmArg HeapDumpOnOutOfMemoryError to be optional #1212

Closed

Description

@licam

Expected Behavior

Do not write heap dump files in case the user doesn't wants it. The user can disable this by a setting.

Current Behavior

The extension adds '-XX:+HeapDumpOnOutOfMemoryError' automatically:
https://github.com/spring-projects/sts4/blob/main/vscode-extensions/vscode-spring-boot/lib/Main.ts#L43
On cases where our users get OOM, their file system is blowing up with the hprof files. Can this be disabled by a setting? It can be set to true by default, and when a user wish to not have this files he can choose to disable it.

Context
We will use -XX:HeapDumpPath to write the files to some temp folder. But we need to be able to not have it written at all, as was on older versions of this extension. As our IDE is on cloud with shared resources it's problematic once this huge files are generated and blows up the disk.

Activity

  1. added this to the 4.22.1.RELEASE milestone on Mar 21, 2024
  2. added
    for: vscode
    and removed on Mar 21, 2024
  3. martinlippert commented on Mar 21, 2024

    @martinlippert
    Member

    Absolutely agree @licam , this default setting it still there from the early days and should be removed. In case of debugging OOM situations, users can add this back via the preferences.

  4. martinlippert commented on Mar 21, 2024

    @martinlippert
    Member

    Beyond that: if you are encouraging OOM situations with the language server process (sounds like you do), it would be extremely interesting to share some details here (maybe even one of those generated heap dumps) to debug this situation and see why you are running into the OOM situation.

  5. licam commented on Mar 21, 2024

    @licam
    Author

    Thank you for the prompt response. We have a certain case where there's a huge Java project and the users gets OOM all the time from the extension. For our best understanding, that's because of the size of the project. Unfortunately we do not have the project either as it's a customer's project and they are not allowed to share. Regarding the heap dump, I'm verifying it.

  6. martinlippert commented on Mar 21, 2024

    @martinlippert
    Member

    You could also add -Xmx2048m as a JVM arg to the preferences for the JVM that is used to run the language server in order to avoid the OOM situation as well. But nevertheless, it would be extremely interesting to analyze the OOM situation in more detail for us.

  7. licam commented on Mar 21, 2024

    @licam
    Author

    Thanks. We are aware of that, but as the resources are shared between the cloud users, increasing the heap size might have a negative effect on other users.

  8. martinlippert commented on Mar 21, 2024

    @martinlippert
    Member

    Understand. One additional argument to dive deeper here and analyze the root cause of the OOM and fix that... :-)

  9. BoykoAlex commented on Mar 21, 2024

    @BoykoAlex
    Contributor

    Fixed with 01a69ba

  10. martinlippert commented on Mar 27, 2024

    @martinlippert
    Member

    @licam I still would love to get a few more details about this OOM and try to find the root cause for this. Can you provide insights into:

    • how large is the project? how many java source files (roughly)?
    • if you enable the log output of the Spring Boot language server to be written to a file (you can define a file in the preferences), could you paste the OOM stack trace that shows up there and maybe a few additional lines above that exception (or - if possible - the full log file)?

    I would like to investigate this in more detail to see if we can avoid the OOM altogether and make the tooling work smoothly even if you have those large projects and limited memory settings for the tooling and the language server process.

    Very much hope that you can share those details.

  11. licam commented on Mar 28, 2024

    @licam
    Author

    @martinlippert The project contains around 16K Java files.

    Here's the stack trace:
    pool-5-thread-1
    at java.lang.OutOfMemoryError.()V (OutOfMemoryError.java:48)
    at java.util.Arrays.copyOfRange([CII)[C (Arrays.java:3966)
    […]
    at org.eclipse.jdt.core.dom.ASTParser.createASTs([Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;Lorg/eclipse/jdt/core/dom/FileASTRequestor;Lorg/eclipse/core/runtime/IProgressMonitor;)V (ASTParser.java:1049)
    at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.scanFiles(Lorg/springframework/ide/vscode/commons/java/IJavaProject;[Ljava/lang/String;Ljava/util/List;Ljava/util/List;Ljava/util/function/BiConsumer;Lorg/springframework/ide/vscode/boot/java/utils/SpringIndexerJava$SCAN_PASS;)[Ljava/lang/String; (SpringIndexerJava.java:566)
    at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.scanFiles(Lorg/springframework/ide/vscode/commons/java/IJavaProject;[Ljava/lang/String;Z)V (SpringIndexerJava.java:498)
    at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.initializeProject(Lorg/springframework/ide/vscode/commons/java/IJavaProject;Z)V (SpringIndexerJava.java:153)
    at org.springframework.ide.vscode.boot.app.SpringSymbolIndex$InitializeProject.run()V (SpringSymbolIndex.java:871)
    at java.util.concurrent.CompletableFuture$AsyncRun.run()V (CompletableFuture.java:1804)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V (ThreadPoolExecutor.java:1136)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run()V (ThreadPoolExecutor.java:635)
    at java.lang.Thread.run()V (Thread.java:833)

  12. martinlippert commented on Mar 28, 2024

    @martinlippert
    Member

    @licam Thanks for the additional details, much appreciated. I might ask you to try a snapshot with this huge project to see if future changes make a reasonable difference, so stay tuned and be prepared... ;-)

    Also, if you have tried different -Xmx settings, it would be interesting to hear how much memory would make the OOM error to not appear anymore.

  13. licam commented on Mar 28, 2024

    @licam
    Author

    I tried asking the customer which Xmx value is enough for his project but I don't have a reply yet.
    I'll add here any more information once I'll have it.
    Regarding the snapshot, it will be great. Thanks!

  14. martinlippert commented on Apr 3, 2024

    @martinlippert
    Member

    I will continue the work on optimizing the memory consumption in #1219. Looks like the indexing mechanism (which parses the source files) is causing the memory spikes and therefore OOM errors when indexing projects with many source files.

  15. martinlippert commented on Apr 9, 2024

    @martinlippert
    Member

    Some early results of the memory footprint improvements: #1219 (comment)

  16. licam commented on May 30, 2024

    @licam
    Author

    Hi @martinlippert, when will you release vscode-spring-boot 1.54.0 to open-vsx?

  17. martinlippert commented on May 30, 2024

    @martinlippert
    Member

    Hi @martinlippert, when will you release vscode-spring-boot 1.54.0 to open-vsx?

    Done, thanks for the reminder. Looks like something went wrong unnoticed during the automation here.

  18. licam commented on May 30, 2024

    @licam
    Author

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: vscodetype: enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions