1

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.

Filipe Miranda
  • 914
  • 1
  • 20
  • 33

1 Answers1

2

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

commit-man
  • 376
  • 1
  • 2
  • 5