How many time does an application have to perform cleanup when a SIGABORT is received?

50 Views Asked by At

I've been testing a critical application against signals it might receive:

  • SIGTEMRM aka kill -15 can be ignored, so in this case I can take any time cleaning up everything before a graceful shutdown;

  • SIGKILL aka kill -9 cannot be caught by the application, so in this case I cannot do much;

  • SIGABORT aka kill -6 can be caught by the application, but I cannot be ignored. In this case, how many time do I have approximately to perform cleanup and a graceful shutdown? Is that a few milliseconds or less?

1

There are 1 best solutions below

3
On BEST ANSWER

Whether a signal is ignorable has no bearing on if and when it is followed by SIGKILL.

Systemd gives processes 90 seconds by default after sending SIGTERM before killing the processes with SIGKILL. This can be configured on a per service basis (and packaged with the service), or system wide. Systemd can also try arbitrary commands before sending SIGTERM.

Other init systems have similar timeouts, and nesting of init systems reduces the available inner timeouts.

Humans are also rather variable as to how tolerant they are of slow shutdowns.