0

Usually, I use jstack to check if the java process is working normally. While i found, when the /tmp/java_pid<num> (the num is pid of java process) socket file has been deleted, jstack will not work. like this:

[xxx]$ jstack -l 5509

5509: 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

(PS. I didn't want to use the "-F", there may be other problems)

Is there any way to change the socket file location(not /tmp)? or to generate the socket file again when found not existed? Now what i did is to restart the java process again, a very bad solution.

Thanks!

Armali
  • 18,255
  • 14
  • 57
  • 171
dongdong
  • 25
  • 1
  • 4

1 Answers1

2

/tmp/.java_pid socket is used by HotSpot Dynamic Attach mechanism. It is the way how jstack and other utilities communicate with JVM.

You cannot change the path - it is hardcoded in JVM source code. Neither you can force JVM to regenerate it, because the Attach Listener is initialized only once in HotSpot lifetime.

jstack -F works in a quite different way.

In order to check whether Java process works fine, I suggest using JMX remote.

Community
  • 1
  • 1
apangin
  • 92,924
  • 10
  • 193
  • 247
  • Thanks you! we just want to get dump info. I check the "Dynamic Attach", and found the "sendQuitTo". this is very helpful!. We can use "kill -3" to get the info, which get rid of socket file. – dongdong Aug 26 '15 at 03:36