Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wkia opened this issue Nov 9, 2023 · 2 comments
Closed

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

wkia opened this issue Nov 9, 2023 · 2 comments

Comments

@wkia
Copy link

wkia commented Nov 9, 2023

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");
    }
}
@wkia
Copy link
Author

wkia commented Nov 10, 2023

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

@testforstephen
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants