You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by ay...@apache.org on 2022/02/14 18:56:29 UTC
[bookkeeper] branch master updated: Ensure BookKeeper process receives sigterm in docker container
This is an automated email from the ASF dual-hosted git repository.
ayegorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 4710fed Ensure BookKeeper process receives sigterm in docker container
4710fed is described below
commit 4710fed8a409736e9e5e0aae5b87fdc6b56ed51a
Author: Jack Vanlightly <va...@gmail.com>
AuthorDate: Mon Feb 14 19:56:19 2022 +0100
Ensure BookKeeper process receives sigterm in docker container
### Motivation
Current official docker images do not handle the SIGTERM sent by the docker runtime and so get killed after the timeout. No graceful shutdown occurs.
The reason is that the entrypoint does not use `exec` when executing the `bin/bookkeeper` shell script and so the BookKeeper process cannot receive signals from the docker runtime.
### Changes
Use `exec` when calling the `bin/bookkeeper` shell script.
Reviewers: Nicolò Boschi <bo...@gmail.com>, Enrico Olivelli <eo...@gmail.com>, Lari Hotari <None>, Matteo Merli <mm...@apache.org>
This closes #2857 from Vanlightly/docker-image-handle-sigterm
---
docker/scripts/entrypoint.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docker/scripts/entrypoint.sh b/docker/scripts/entrypoint.sh
index 657eb6b..753f59a 100755
--- a/docker/scripts/entrypoint.sh
+++ b/docker/scripts/entrypoint.sh
@@ -41,11 +41,11 @@ function run_command() {
chmod -R +x ${BINDIR}
chmod -R +x ${SCRIPTS_DIR}
echo "This is root, will use user $BK_USER to run command '$@'"
- sudo -s -E -u "$BK_USER" /bin/bash "$@"
+ exec sudo -s -E -u "$BK_USER" /bin/bash -c 'exec "$@"' -- "$@"
exit
else
echo "Run command '$@'"
- $@
+ exec "$@"
fi
}