iv-org / inv_sig_helper

GNU Affero General Public License v3.0
29 stars 9 forks source link

Manually set signal handlers for SIGTERM and SIGINT if running as PID 1 (in container) #20

Closed mini-bomba closed 2 months ago

mini-bomba commented 2 months ago

When a program is running as PID 1, its default SIGTERM and SIGINT handlers ignore the signal completely, instead of exiting. As the program is running as PID 1 in the container, and does not set its own handlers for these signals, it ignores them, which makes it unnecessarily take longer to stop the container, as podman/docker waits some time after sending SIGTERM before resorting to SIGKILL.

The program should set its own handlers for SIGTERM and SIGINT, which do the necessary cleanup (if necessary) and exit.

techmetx11 commented 2 months ago

Maybe it's better to just use Docker's builtin tiny init program