Can I reset the current thread stack variables from a live JVM?

I need to peek into the stack of two deadlock threads to analyze the situation. JVM right now, and there is data, but I need some kind of tool to extract it from the process. I'm only interested in 6 variables on a stack of type String . Any ideas are welcome. JVM version 6_35 , it supports linux , JMX , but I do not have a profiler/debugger connection configured on it. It is very difficult to reproduce.

+7
source share
3 answers

You cannot do it easily. The usual jstack tool will only delete the stack. Technically, you can try dropping a whole bunch (using jmap ), but finding these variables can be a pain if possible.

Please note that this is not easy to do for security reasons. Stack traces may contain credentials or other sensitive data.

+3
source

I found a little trick using a heap dump viewer (YourKit in this case, but there may be others). Basically you list all instances of the Thread class, then you find the thread you need by name and open it. Stack variables are marked as <local variable> :

enter image description here

Not all variables here, but all that are passed as arguments to the method are displayed. I wonder if the profiler can solve this problem even better?

+1
source

You can send a SIGQUIT process that will dump you and save the virtual machine running on a Unix-like OS with Sun / Oracle JVM, and IBM JVM is not sure that the output will be suitable for your purposes, hard. Probably similar to jstack / jmap in another answer.

0
source

All Articles