matt freake
matt freake

Reputation: 5090

Does "kill -QUIT" ever actually kill the JVM?

Running kill -QUIT on a Unix system will trigger a thread dump. 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".

I'm struggling to find any references online to kill -QUIT behaving this way.

Can anyone confirm that it could actually kill the java process/cause the JVM to quit?

(Obviously one way for it to do this would if someone didn't correctly type "-QUIT" :-))

Upvotes: 0

Views: 653

Answers (1)

Jonathan
Jonathan

Reputation: 7604

In 12 years I have never seen kill -QUIT crash a 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. But anything could crash a JVM in that situation. 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.

Upvotes: 2

Related Questions