VisualVM getting stuck ( Not responding ) after starting java application in local
souvikadh opened this issue · 12 comments
VisualVM getting stuck ( Not responding ) after starting java application in local
It becomes responsive once I stopped/killed the running java application.
To Reproduce
Steps to reproduce the behavior:
- Start any java application in local IDE ( I am using intelliJ, Mac OS14.4.1 (23E224))
- Click on visualVM
- Tap on the process id
- application freezed
Expected behavior
The application should be acting normally.
VisualVM log
Please attach VisualVM logfile.txt file to help diagnose your problem.
messages.log is available via Help | About | Logfile and
via VisualVM | About VisualVM | Logfile on macOS
Desktop (please complete the following information):
- OS: Mac OS14.4.1 (23E224)
- JDK version [JDK 17.0.6]
- Version [2.1.8]
Additional context
Add any other context about the problem here.
Unfortunately, I am not able to reproduce it. Can you be more specific? Can you share test1.Main
application?
@thurka Below one I have used, You can increase number of iterations ( i < 100000 or more ) if you are not getting the freezing issue.
try (ExecutorService executorService = Executors.newFixedThreadPool(15)) {
for (int i = 0; i < 10000; i++) {
executorService.execute(() -> {
System.out.println("Thread name : " + Thread.currentThread());
});
}
}
I am not sure I understand what is the source code test1.Main
application. Are you suggesting that I should try to run code below to reproduce the problem?
package test1;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Main {
public static void main(String[] args) {
try (ExecutorService executorService = Executors.newFixedThreadPool(15)) {
for (int i = 0; i < 10000; i++) {
executorService.execute(() -> {
System.out.println("Thread name : " + Thread.currentThread());
});
}
}
}
}
@thurka Yes, correct and if the issue is not reproduced with above code, you can try to increase the for loop size i.e. 10000 or more.
Hi there,
I faced similar issue last week. I suspect it is something related to the new version of IntelliJ IDE.
In my case, my runtime was like this:
- Win 11
- JDK 1.8 was configured for visualvm_jdkhome
- IntelliJ CE latest version (runtime is JDK 17 of Jetbrain)
I tried to start VisualVM a few times but it always end up frozen.
My solution is to configure JDK 21 as visualvm_jdkhome. After that, all works well. However, I don't know the detailes underneath.
Hope this informaiton might help.
Regards,
@thurka Yes, correct and if the issue is not reproduced with above code, you can try to increase the for loop size i.e. 10000 or more.
Thanks a lot for clarification, howerver I have trouble compiling your testcase on JDK 17:
test1/Main.java:9: error: incompatible types: try-with-resources not applicable to variable type
try (ExecutorService executorService = Executors.newFixedThreadPool(15)) {
^
(ExecutorService cannot be converted to AutoCloseable)
1 error
@imspzero Can you please attach the messages.log, which is available via VisualVM | About VisualVM | Logfile. I would like to see how it looks like when VisualVm is frozen running on JDK 8. BTW: Can you specify, what exactly you did? Did you start some application from Intellij or not?
@thurka Please try below code snippet.
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Main {
public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(15);
for (int i = 0; i < 10000; i++) {
executorService.execute(() -> {
System.out.println("Thread name : " + Thread.currentThread());
});
}
executorService.shutdown();
}
}
Thanks for the above test case. I will try to reproduce the problem.
Unfortunately I am not able to reproduce your problem. Below is description of my test.
I created project in intelliJ and used your Main class. I have to increase the loop to 10000000 to get more time. I was able to:
- start test application from IntelliJ
- start VisualVM
- open test application in VisualVM
- see the data from test application just fine
I am using macOS 13.6.7 on Apple M1 Pro.
VisualVM and test application are running on OpenJDK 21