简体   繁体   English

“kill -QUIT”实际上是否会杀死JVM?

[英]Does “kill -QUIT” ever actually kill the JVM?

Running kill -QUIT on a Unix system will trigger a thread dump. 在Unix系统上运行kill -QUIT将触发线程转储。 I know this because I have done this hundreds of times. 我知道这是因为我做了好几百次。

However, another developer tells me he has seen this "crash the JVM" and using twiddle or the JMX API is "safer". 然而,另一位开发人员告诉我他已经看到这种“崩溃JVM”并使用旋转或JMX API“更安全”。

I'm struggling to find any references online to kill -QUIT behaving this way. 我正在努力寻找任何在线参考来kill -QUIT这样做。

Can anyone confirm that it could actually kill the java process/cause the JVM to quit? 任何人都可以确认它实际上可以杀死java进程/导致JVM退出吗?

(Obviously one way for it to do this would if someone didn't correctly type "-QUIT" :-)) (显然有一种方法可以做到这一点,如果有人没有正确输入“-QUIT”:-))

In 12 years I have never seen kill -QUIT crash a JVM. 在12年中,我从未见过kill -QUIT崩溃JVM。 But as Disco 3 says, if you're doing a thread dump while the JVM is in distress (which is when you usually do thread dumps), it may (possibly?) crash with an OutOfMemoryError . 但正如Disco 3所说,如果你在JVM处于遇险状态时进行线程转储(这是你通常进行线程转储的时候),它可能(可能?)与OutOfMemoryError崩溃。 But anything could crash a JVM in that situation. 但在这种情况下, 任何事情都可能导致JVM崩溃。 I wouldn't hesitate to use kill -QUIT , but you may find jstack more useful because it will dump the thread dump to your stdout rather than the JVM's. 我会毫不犹豫地使用kill -QUIT ,但你可能会发现jstack更有用,因为它会将线程转储转储到你的 stdout而不是JVM。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM