Does kill -3 actually terminate a java process? Or just generate a thread dump?
CentOS 5.9
If I run kill -3 <java process pid>
what actually happens? As per this red hat article, I understand that a Java Thread Dump is generated but is the process terminated? It doesn't appear to be based on my tests:
[root@foobox ~]# kill -3 14559
[root@foobox ~]# service foo status
foo (pid 14559) is running...
In other words: could I collect a thread dump via this manner without impacting the service?
Hopefully, kill -3
doesn't terminate the JVM process.
A thread dump is very slightly impacting the service during the stacktrace collection, especially if thousands of threads are running.
Note that if the -Xrs
flag is used, the JVM no more specifically handle the SIGQUIT
signal and then that signal will likely terminate the process unless a alternate handler is in place in some native code.
https://superuser.com/questions/352147/what-does-kill-3-mean may provide with you some more information.
It's up to the process to determine how exactly it's going to react when it receives SIGQUIT
Since that signal can be caught, ignored, or blocked by the process it may not respect the kill
. If you want like to peer even closer I suggest stack tracing the PID with strace
while sending it SIGQUIT
with kill.