What's the cause of Unable to open socket file: process not responding while Dumping the JVM? [duplicate]

冷暖自知 提交于 2020-06-28 04:43:48

问题


I am running the command:

jstack 1234 > threadDump.tdump

On an PID of a Java process. I keep getting the following message:

Unable to open socket file: target process not responding or HotSpot VM not loaded The -F option can be used when the target process is not responding

I am not asking just how to solve, but I want to understand why I am getting this message, since I never got it in the past.

I am on a Unix Red Hat.


回答1:


This is how dynamic attach works: tool ( jstack in your case ) sends signal ( -3 ) to target vm. But before sending signal, tool will create attach file. When VM receives signal, it will search for this file. If file exists, then it will create unix socket. Meanwhile tool will wait for creation of this socket. And if this file will not exist, it will print this error message. You can find this code ( tool part ) in sun.tools.attach.LinuxVirtualMachine. This file from jdk_home/lib/tools.jar file. Code for hotspot part signal_thread_entry from os.cpp, AttachListener::init.

I think that for some reason vm can't create socket file during 5 seconds ( it is default timeout, that can be changed via -Dsun.tools.attach.attachTimeout property). Or maybe you run vm with -XX:+ReduceSignalUsage flag? in this case remove this flag from your command line



来源:https://stackoverflow.com/questions/38526741/whats-the-cause-of-unable-to-open-socket-file-process-not-responding-while-dum

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!