Regression: Graceful shutdowns for GremlinServer (#2712)
* Prefix calls to gremlin-server.sh and java with exec. This will forward the signals. CAUTION: It works for my use case but I don't know what this may break.
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index f70c1c1..77968d6 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -36,6 +36,7 @@
* Fix cases where Map keys of incomparable types could panic in `gremlin-go`.
* Fixed an issue where missing necessary parameters for logging, resulting in '%!x(MISSING)' output in `gremlin-go`.
* Added getter method to `ConcatStep`, `ConjoinStep`, `SplitGlobalStep` and `SplitLocalStep` for their private fields.
+* Gremlin Server docker containers shutdown gracefully when receiving a SIGTERM.
[[release-3-7-2]]
=== TinkerPop 3.7.2 (April 8, 2024)
diff --git a/gremlin-server/src/main/bin/gremlin-server.sh b/gremlin-server/src/main/bin/gremlin-server.sh
index 41e446b..b7aebf2 100755
--- a/gremlin-server/src/main/bin/gremlin-server.sh
+++ b/gremlin-server/src/main/bin/gremlin-server.sh
@@ -209,7 +209,7 @@
fi
if [[ -z "$RUNAS" ]]; then
- $JAVA -Dlogback.configurationFile=$LOGBACK_CONF $JAVA_OPTIONS -cp $CLASSPATH $GREMLIN_SERVER_CMD "$GREMLIN_YAML"
+ exec $JAVA -Dlogback.configurationFile=$LOGBACK_CONF $JAVA_OPTIONS -cp $CLASSPATH $GREMLIN_SERVER_CMD "$GREMLIN_YAML"
exit 0
else
echo Starting in foreground not supported with RUNAS
diff --git a/gremlin-server/src/main/docker/docker-entrypoint.sh b/gremlin-server/src/main/docker/docker-entrypoint.sh
index af7050c..1b7456d 100755
--- a/gremlin-server/src/main/docker/docker-entrypoint.sh
+++ b/gremlin-server/src/main/docker/docker-entrypoint.sh
@@ -29,12 +29,4 @@
IP=$(ip -o -4 addr list eth0 | perl -n -e 'if (m{inet\s([\d\.]+)\/\d+\s}xms) { print $1 }')
sed -i "s|^host:.*|host: $IP|" $CONF_FILE
-handler()
-{
- kill -s SIGINT "$PID"
-}
-
-exec $GREMLIN_SERVER "$@" &
-PID=$(ps | grep -w $GREMLIN_SERVER | grep -v grep | awk 'NR==1 {print $1}')
-trap 'handler $PID' SIGTERM
-wait "$PID"
+exec $GREMLIN_SERVER "$@"