[PR #2488] [MERGED] Add tini as PID 1 handler in container image #3726

Closed
opened 2026-04-25 00:16:49 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/2488
Author: @FreedomBen
Created: 1/3/2024
Status: Merged
Merged: 1/4/2024
Merged by: @advplyr

Base: masterHead: add-init-system-to-docker


📝 Commits (1)

  • baa65b8 Add tini as PID 1 handler in container image

📊 Changes

1 file changed (+3 additions, -1 deletions)

View changed files

📝 Dockerfile (+3 -1)

📄 Description

This PR adds tini to the container image and uses it as PID 1 when starting the container. This ensures that proper PID 1 signal-handling is implemented and passed to the underlying node.js process, thereby ensuring that the ABS process has a chance to receive and handle signals other than SIGKILL, such as the important SIGINT.

This is somewhat related to #2445 . Without this, the signal handled by 2445 won't be received when running in a container.

Some background:

In linux, PID 1 has special duties involving signal handling that are different than other processes. Node doesn't properly handle these signals, which can lead to a number of problems ranging from annoying to disruptive. PID 1 also has reaping duties that can lead to resource exhaustion if not properly handled.

For example, the container ignores SIGINT (Ctrl+C) as well as docker stop, which can be annoying in development as you have to kill or wait for the timeout to be reached. In a production environment (such as Kubernetes) this can lead to signal escalation and unnecessarily adds delays to deployments and restarts as K8s has to wait for the timeout to be reached before sending SIGKILL.

At best this is annoying and unnecessarily adds
delays. At worst this can lead to file/data corruption as the process doesn't get a chance to clean anything up when it is sent SIGKILL. Without a proper PID 1 to forward signals, only SIGKILL can be used to terminate the running process.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/2488 **Author:** [@FreedomBen](https://github.com/FreedomBen) **Created:** 1/3/2024 **Status:** ✅ Merged **Merged:** 1/4/2024 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `add-init-system-to-docker` --- ### 📝 Commits (1) - [`baa65b8`](https://github.com/advplyr/audiobookshelf/commit/baa65b8155aa21468650f5859c4dc42ece478a6b) Add tini as PID 1 handler in container image ### 📊 Changes **1 file changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `Dockerfile` (+3 -1) </details> ### 📄 Description This PR adds `tini` to the container image and uses it as PID 1 when starting the container. This ensures that proper PID 1 signal-handling is implemented and passed to the underlying node.js process, thereby ensuring that the ABS process has a chance to receive and handle signals other than `SIGKILL`, such as the important `SIGINT`. This is somewhat related to #2445 . Without this, the signal handled by 2445 won't be received when running in a container. Some background: In linux, PID 1 has special duties involving signal handling that are different than other processes. Node doesn't properly handle these signals, which can lead to a number of problems ranging from annoying to disruptive. PID 1 also has reaping duties that can lead to resource exhaustion if not properly handled. For example, the container ignores `SIGINT` (Ctrl+C) as well as `docker stop`, which can be annoying in development as you have to kill or wait for the timeout to be reached. In a production environment (such as Kubernetes) this can lead to signal escalation and unnecessarily adds delays to deployments and restarts as K8s has to wait for the timeout to be reached before sending `SIGKILL`. At best this is annoying and unnecessarily adds delays. At worst this can lead to file/data corruption as the process doesn't get a chance to clean anything up when it is sent `SIGKILL`. Without a proper PID 1 to forward signals, only SIGKILL can be used to terminate the running process. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:16:49 +02:00
adam closed this issue 2026-04-25 00:16:49 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3726