Skip to content

High CPU usage and memory consumption even if doing nothing #1408

Closed

Description

@wkia

I'm working with OpenJDK 11/17/21/... source code on Windows 11, WSL, and Linux.

"Debugger for Java" is v0.55.0. This issue is related to #1330 (comment), but I tried to reproduce it from scratch.

The example from WSL, I opened VS Code with my workspace, waited some time and seen - "redhat.java" has been consuming CPU and memory for a long time:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 6174 user      20  0   37.9g  14.2g   3.5m  S 832.9  91.0  11:57.35 /home/user/.vscode-server/extensions/redhat.java-1.24.0-linux-x64/jre/17.0.8.1-linux-x86_64/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.fs=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.ecli+

And then, when memory is about to out, it looks like it drops the process and starts again - with a small amount of memory and high CPU usage, increasing memory consumption every minute.

Steps To Reproduce (on Win11/WSL)
  1. Install VSCode on Win11, and install "Remote Development" extension pack
  2. Open WSL terminal, and run the following commands:
  3. git clone https://github.com/openjdk/jdk.git openjdk
  4. cp MyApp.java openjdk (see below for MyApp.java source code)
  5. cd openjdk
  6. code . &
  7. In VSCode, install "Debugger for Java", "Language support for Java by Red Hat" to remote WSL.
  8. In VSCode, open ~/openjdk/MyApp.java file in editor.
  9. In WSL terminal, run top -c and see .vscode-server/extensions/redhat.java-1.24.0-linux-x64/jre/17.0.8.1-linux-x86_64/bin/java consuming CPU and memory. (in my case it consumes all CPU cores)
  10. Wait patiently, and still click 'Increase memory' and 'Reload window' in VSCode if it asks, continue seeing RedHat java process in top -c list consuming CPU and RAM.
  11. You could stop here, but you also can try to reach the maximum memory amount in WSL by clicking 'Increase memory'/'Reload window', and possibly you will see behaviour described above - "when memory is about to out, it looks like it drops the process and starts again"
  12. (Optional) You could also try to close and open VSCode again, instead of 'Reload'ing window. It seems it helps to reproduce it faster.
MyApp.java
public class MyApp {
    public static void main(String[] args) {
        System.out.println("Hello world!");
        System.out.println("Sleeping...");
        Thread.sleep(20000);
        System.out.println("Finished");
    }
}

Activity

  1. wkia commented on Nov 10, 2023

    @wkia
    Author

    Hmm, it seems like the issue is related to "Language support for Java". It'd be great to push them to fix the problem.

  2. testforstephen commented on Nov 10, 2023

    @testforstephen
    Contributor

    Yes, this is related to Java language support extension. Looks like the auto build job is taking too much CPU and memory in compiling.

    Moved it to the issue redhat-developer/vscode-java#3387 for further discussion.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions