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

VisualVM getting stuck ( Not responding ) after starting java application in local #565

Open
souvikadh opened this issue Apr 1, 2024 · 12 comments
Labels

Comments

@souvikadh
Copy link

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:

  1. Start any java application in local IDE ( I am using intelliJ, Mac OS14.4.1 (23E224))
  2. Click on visualVM
  3. Tap on the process id
  4. 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

Screenshots
image

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.

@souvikadh souvikadh added the bug label Apr 1, 2024
@souvikadh
Copy link
Author

souvikadh commented Apr 2, 2024

@thurka Please have a look.

@thurka
Copy link
Member

thurka commented Apr 10, 2024

Unfortunately, I am not able to reproduce it. Can you be more specific? Can you share test1.Main application?

@souvikadh
Copy link
Author

souvikadh commented Apr 10, 2024

@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());

               });
           }
       }

@thurka
Copy link
Member

thurka commented Apr 17, 2024

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());

                });
            }
        }
    }
}

@souvikadh
Copy link
Author

@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.

@imspzero
Copy link

imspzero commented May 4, 2024

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
Copy link
Member

thurka commented May 6, 2024

@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

@thurka
Copy link
Member

thurka commented May 6, 2024

@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?

@souvikadh
Copy link
Author

@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();
    }
}

@thurka
Copy link
Member

thurka commented Jun 20, 2024

Thanks for the above test case. I will try to reproduce the problem.

@thurka
Copy link
Member

thurka commented Jun 20, 2024

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:

  1. start test application from IntelliJ
  2. start VisualVM
  3. open test application in VisualVM
  4. 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

@souvikadh
Copy link
Author

Strange! That means it occurs sometimes with someone for some piece of codes! @imspzero can you please provide your code snippet here to re-produce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants