Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ All notable changes to this project will be documented in this file.
- spark: bump hadoop `3.4.2` to `3.4.3` ([#1533])
- hive: Bump `4.2.0` to Hadoop `3.4.3` ([#1539]).
- java-devel: Bump Maven to 3.9.16 ([#1548]).
- spark: fix graceful shutdown at SIGTERM ([#1564])

### Fixed

Expand Down Expand Up @@ -95,6 +96,7 @@ All notable changes to this project will be documented in this file.
[#1550]: https://github.com/stackabletech/docker-images/pull/1550
[#1551]: https://github.com/stackabletech/docker-images/pull/1551
[#1559]: https://github.com/stackabletech/docker-images/pull/1559
[#1564]: https://github.com/stackabletech/docker-images/pull/1564

## [26.3.0] - 2026-03-16

Expand Down
2 changes: 1 addition & 1 deletion spark-k8s/Dockerfile.3
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,4 @@ EOF
USER ${STACKABLE_USER_UID}

WORKDIR ${SPARK_HOME}
ENTRYPOINT [ "/stackable/run-spark.sh" ]
ENTRYPOINT [ "/usr/bin/tini", "-s", "--", "/stackable/run-spark.sh" ]
2 changes: 1 addition & 1 deletion spark-k8s/Dockerfile.4
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,4 @@ EOF
USER ${STACKABLE_USER_UID}

WORKDIR ${SPARK_HOME}
ENTRYPOINT [ "/stackable/run-spark.sh" ]
ENTRYPOINT [ "/usr/bin/tini", "-s", "--", "/stackable/run-spark.sh" ]
16 changes: 15 additions & 1 deletion spark-k8s/stackable/run-spark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@

eval "$_STACKABLE_PRE_HOOK"

/stackable/spark/kubernetes/dockerfiles/spark/entrypoint.sh "$@"
# Forward SIGTERM to the Spark entrypoint to support spark JVM's gracefully shutdown.
/stackable/spark/kubernetes/dockerfiles/spark/entrypoint.sh "$@" &
child_pid=$!

# shellcheck disable=SC2329
_handle_term() {
kill -TERM "$child_pid" 2>/dev/null || true
}
trap _handle_term TERM INT

# `wait` returns immediately when the trap fires; loop until the child is actually gone.
wait "$child_pid"
while kill -0 "$child_pid" 2>/dev/null; do
wait "$child_pid" 2>/dev/null || true
done
result=$?

eval "$_STACKABLE_POST_HOOK"
Expand Down