VisualVM hangs with 100% cpu usage · Issue #461 · oracle/visualvm · GitHub
source link: https://github.com/oracle/visualvm/issues/461
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
VisualVM hangs with 100% cpu usage #461
cowwoc opened this issue Oct 27, 2022 · 13 comments
VisualVM hangs with 100% cpu usage #461
cowwoc opened this issue Oct 27, 2022 · 13 comments
Comments
cowwoc commented Oct 27, 2022 •
Describe the bug This issue could be related to #101 though I suspect you have upgraded the Marlin rendering engine that ships with VisualVM at this point. VisualVM log messages.log is available via Help | About | Logfile and Screenshots Desktop (please complete the following information):
Additional context Looking at messages.log, I can see VisualVM is running out of memory but it's not clear to me why. I just opened it and attached it to monitor two JVMs. This typical usage should not cause this kind of crash. |
Member
thurka commented Nov 1, 2022
The splitted heap dump seems to be messed up. I am not able to combine zip file from it. Anyway visualvm is running with |
Member
thurka commented Nov 1, 2022
Please see https://youtrack.jetbrains.com/issue/IDEA-305072. Maybe this is one and the same (JDK) bug? This is the application I am attaching VisualVM to. |
Member
thurka commented Nov 2, 2022
I don't see how this is related to this bug. Can you please provide the heap dump I asked for? This could give me something I can investigate. |
@thurka I've posted an updated heap dump for your review at |
Member
thurka commented Nov 3, 2022
Thanks, I downloaded the heap dump. |
@thurka I again think that this issue is related to the JDK hang bug I referenced earlier. If you take a look at https://bugs.openjdk.org/browse/JDK-8296463 Fairoz Matte is only able to reproduce the JDK hang if VisualVM is attached. Something screwy is going on. Maybe once you fix this bug, the other bug will go away as well. Did you have any luck with the heap dump? |
w6et commented Nov 10, 2022
I'm not sure,I guess "monitor two JVMs",maybe operate same file or something else, occured an exception:" Could not open PerfMemory", then cause rmi.newSocket again again(maybe some required arguments is missing)--->SEVERE [null]: Last record repeated again.-->OOM |
Member
thurka commented Nov 10, 2022
The heap dump shows that the monitored application creates enormenous number of new threads. Threads view needs to store some info for every thread, so this ultimately leads to OOME. The solution is to run VisualVM with increased Xmx. Default is 768M. |
Author
cowwoc commented Nov 10, 2022
@thurka Okay, this is beginning to make more sense. Does VisualVM retain memory for dead threads? If so, increasing the maximum amount of memory won't help because ultimately it'll still run out of memory. As you correctly pointed out, we are creating (and destroying) millions of threads per hour. With JDK 19's ThreadPerTask executor this is going to become a common use-case. |
Member
thurka commented Nov 11, 2022
Yes, you can display data for dead threads, so the info for already dead threads are preserved.
If you plan to monitor it for very long time, yes. With increased Xmx, it can extend the monitoring time long enough, so you can find the information you are looking for (whatever it is).
Unless I misunderstood JEP 425: Virtual Threads, you should use virtual threads in this situation. You can try it for yourself. In PlatformThreadsTestcase just replace:
|
This will have to change. It doesn't matter how much memory we throw at VisualVM, the minute an application uses Two options that come to mind:
I personally prefer option 2. It would work regardless of the
I think you misunderstood my point. I meant that once VisualVM adds support for virtual threads (i.e. the Threads tab shows virtual threads, not just carrier threads) then anyone using virtual threads will encounter this OOME problem fairly quickly. We need to fix this problem. |
Author
cowwoc commented Nov 25, 2022
The JDK bug (https://bugs.openjdk.org/browse/JDK-8296463) and IDE bug (https://youtrack.jetbrains.com/issue/IDEA-305777) have both been fixed. The only remaining bug associated with the use of Have you given any thought on how to solve this? I mentioned two options above. Maybe you have another approach in mind? |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK