A stateless app can always handle kill -9?
Yes. But even a stateless app handles connections from the outside (or it would do nothing, really!). That is the issue here. If your app, say, some HTTP server that only serves static files, and is thus stateless, were to be routinely killed with -9, then ever so often, you would kill it with an active connection. So your customer would get some HTTP error code. In the best case, it is an unimportant small image and he doesn't even notice; in the worst case, it is your main .js or .css file and he will indeed notice badly.
So, by using a weaker signal, you give your stateless app the chance to finish the current request before shutting down.
Obviously, you can finish it off with -9 if it does not go away after a second or two (or however long you wish to give it time to end its business).
SIGKILLis uncatchable which mean that app will halt in place, while withSIGTERMyou can handle it gracefully like finishing all existing requests (but not accepting new one) whileSIGKILLdo not give you such opportunity. – Hauleth Sep 15 '17 at 23:27ESTABLISHEDstate. I'm sure people (even very smart people with official documentation) call these kinds of programs stateless, but I think they are probably using this terminology wrong... @AnoE - not all apps are networking apps and accept input from a TCP stack. In fact, the more I think about it, there probably are no truly stateless apps. – James Shewey Sep 16 '17 at 14:31