为什么在kill -15之后java进程没有退出?

时间:2014-05-09 09:29:52

标签: java linux jvm kill kill-process

我通过kill -15 $PID杀死java程序,并从日志中发现ShutdownHook被调用并完成。但这个过程仍在继续。

所以我转储线程并找到大部分是守护程序线程,但是以下内容:

[xiafei.qiuxf@dwbasis130009 tesla]$ grep prio stack  | grep -v daemon
"DestroyJavaVM" prio=10 tid=0x00002aaaab072000 nid=0x79d3 waiting for monitor entry [0x0000000041da4000]
"VM Thread" prio=10 tid=0x00002aaaab112000 nid=0x79e6 runnable 
"Gang worker#0 (Parallel GC Threads)" prio=10 tid=0x00002aaaab105800 nid=0x79d4 runnable 
"Gang worker#1 (Parallel GC Threads)" prio=10 tid=0x00002aaaab106800 nid=0x79d5 runnable 
"Gang worker#2 (Parallel GC Threads)" prio=10 tid=0x00002aaaab107000 nid=0x79d6 runnable 
"Gang worker#3 (Parallel GC Threads)" prio=10 tid=0x00002aaaab107800 nid=0x79d7 runnable 
"Gang worker#4 (Parallel GC Threads)" prio=10 tid=0x00002aaaab108000 nid=0x79d8 runnable 
"Gang worker#5 (Parallel GC Threads)" prio=10 tid=0x00002aaaab109000 nid=0x79d9 runnable 
"Gang worker#6 (Parallel GC Threads)" prio=10 tid=0x00002aaaab109800 nid=0x79da runnable 
"Gang worker#7 (Parallel GC Threads)" prio=10 tid=0x00002aaaab10a000 nid=0x79db runnable 
"Gang worker#8 (Parallel GC Threads)" prio=10 tid=0x00002aaaab10a800 nid=0x79dc runnable 
"Gang worker#9 (Parallel GC Threads)" prio=10 tid=0x00002aaaab10b800 nid=0x79dd runnable 
"Gang worker#10 (Parallel GC Threads)" prio=10 tid=0x00002aaaab10c000 nid=0x79de runnable 
"Gang worker#11 (Parallel GC Threads)" prio=10 tid=0x00002aaaab10c800 nid=0x79df runnable 
"Gang worker#12 (Parallel GC Threads)" prio=10 tid=0x00002aaaab10d000 nid=0x79e0 runnable 
"Concurrent Mark-Sweep GC Thread" prio=10 tid=0x00002aaaab111000 nid=0x79e5 runnable 
"Gang worker#0 (Parallel CMS Threads)" prio=10 tid=0x00002aaaab10e800 nid=0x79e1 runnable 
"Gang worker#1 (Parallel CMS Threads)" prio=10 tid=0x00002aaaab10f000 nid=0x79e2 runnable 
"Gang worker#2 (Parallel CMS Threads)" prio=10 tid=0x00002aaaab10f800 nid=0x79e3 runnable 
"Gang worker#3 (Parallel CMS Threads)" prio=10 tid=0x00002aaaab110800 nid=0x79e4 runnable 
"VM Periodic Task Thread" prio=10 tid=0x00002aaaab118000 nid=0x79f1 waiting on condition 

它们似乎是GC线程或jvm的线程,但它们都不是我的(我的线程都已完成。),为什么jvm进程仍然在运行?

1 个答案:

答案 0 :(得分:3)

转储说:

"DestroyJavaVM" prio=10 tid=0x00002aaaab072000 nid=0x79d3 
    waiting for monitor entry [0x0000000041da4000] <<------------

这意味着终止应用程序的过程无法继续,因为有人拥有监视器0x0000000041da4000

查看转储以找出拥有此监视器的线程。这应该会让你知道如何继续。