Skip to content

Commit

Permalink
mariadb: Increase timeout for MariaDB shutdown (home-assistant#3570)
Browse files Browse the repository at this point in the history
* 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 home-assistant#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 home-assistant#3566

* Increase shutdown timeout to 5 minutes
  • Loading branch information
agners authored and miguelrjim committed Apr 26, 2024
1 parent fbfa476 commit 8d187ad
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions mariadb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions mariadb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
Expand Down
4 changes: 2 additions & 2 deletions mariadb/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 2.7.0
version: 2.7.1
slug: mariadb
name: MariaDB
description: A SQL database server
Expand Down Expand Up @@ -41,4 +41,4 @@ schema:
services:
- mysql:provide
startup: system
timeout: 20
timeout: 300
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
295000

0 comments on commit 8d187ad

Please sign in to comment.