From ff6d99ffa1e5f2ad43b9adc9f28c38aa4d36314e Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 18 Apr 2024 09:42:22 +0200 Subject: [PATCH] mariadb: Increase timeout for MariaDB shutdown (#3570) * mariadb: Increase timeout for MariaDB shutdown Currently, when MariaDB takes longer than 20s to shutdown, Docker will simply kill it. This can be problematic on upgrade, as the new MariaDB version cannot handle a not cleanly shutdown MariaDB (see #3566). Increase the timeout of the container shutdown to 60s. Also define a per-service kill timeout for mariadb-core. This is largely optional, and essentially leads to the same outcome if MariaDB takes even longer (it will get killed, one way or another). But by defining this as part of the s6 service makes sure that the add-on log itself shows that MariaDB had to be killed, and makes sure the rest of the s6 service tree gets a chance to shutdown gracefully still: [09:29:37] INFO: Service mariadb exited with code 256 (by signal 9) s6-rc: info: service mariadb-core successfully stopped s6-rc: info: service mariadb-pre: stopping ... The 18s timeout of S6_SERVICES_GRACETIME seems to apply for legacy services only which are no longer used in this add-on. So drop this definition. Fixes #3566 * Increase shutdown timeout to 5 minutes --- mariadb/CHANGELOG.md | 8 ++++++++ mariadb/Dockerfile | 3 +-- mariadb/config.yaml | 4 ++-- .../etc/s6-overlay/s6-rc.d/mariadb-core/timeout-kill | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/timeout-kill diff --git a/mariadb/CHANGELOG.md b/mariadb/CHANGELOG.md index 01f05ce7ead..8ab5abb00dc 100644 --- a/mariadb/CHANGELOG.md +++ b/mariadb/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.7.1 + +**Note:** Restart the add-on before upgrade if the current version is lower +than 2.7.0! This is to ensure a clean stop right before the update (see also +https://github.com/home-assistant/addons/issues/3566). + +- Increase MariaDB add-on shutdown timeout to 300s + ## 2.7.0 - Update to Alpine 3.19 diff --git a/mariadb/Dockerfile b/mariadb/Dockerfile index ceb644ed459..bf255ff1778 100644 --- a/mariadb/Dockerfile +++ b/mariadb/Dockerfile @@ -9,8 +9,7 @@ RUN apk add --no-cache \ pwgen ENV \ - LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \ - S6_SERVICES_GRACETIME=18000 + LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" # Copy data COPY rootfs / diff --git a/mariadb/config.yaml b/mariadb/config.yaml index ac87fae8fdb..14688a86655 100644 --- a/mariadb/config.yaml +++ b/mariadb/config.yaml @@ -1,5 +1,5 @@ --- -version: 2.7.0 +version: 2.7.1 slug: mariadb name: MariaDB description: A SQL database server @@ -41,4 +41,4 @@ schema: services: - mysql:provide startup: system -timeout: 20 +timeout: 300 diff --git a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/timeout-kill b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/timeout-kill new file mode 100644 index 00000000000..94ca7aa4c37 --- /dev/null +++ b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/timeout-kill @@ -0,0 +1 @@ +295000