gpt4 book ai didi

java - kill -15后java进程为什么不退出?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:54:05 24 4
gpt4 key购买 nike

我通过 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进程还在运行?

最佳答案

转储说:

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

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

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

关于java - kill -15后java进程为什么不退出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23561128/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com