Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does "kill -QUIT process_id" work?

I'm just curious. The man page for kill says that QUIT, aka signal # 3, is a "core" signal. It seems that all it does, for Java processes, is dump the thread information. So, is the QUIT as misnomer? Is it just that the JVM implements a singal 3 handler that dumps threads?

like image 210
chad Avatar asked Aug 14 '12 21:08

chad


2 Answers

QUIT is arguably a misnomer for Java. But by that argument any signal name could be a misnomer if an application is allowed to change the default behaviour of the signal's handler.

In reality, the correspondence between UNIX signal names and what they actually do has always been a bit vague and tenuous. However, developers have been dealing with this "issue" for 30+ years without it being a real problem.

And yes, the Java thread stack dump behaviour is implemented by the JVM. The default UNIX / LINUX behaviour is to create a memory dump of the process, unless this is inhibited by other factors.

like image 173
Stephen C Avatar answered Oct 20 '22 07:10

Stephen C


Yea, the JVM captures the #3 signal to dump threads. By default, for a normal unix process, it dumps core (i.e. take a memory snapshot of the process and write it to a file) and exits.

For Java, that isn't very helpful, so it does a thread dump instead.

like image 7
Will Hartung Avatar answered Oct 20 '22 06:10

Will Hartung