This is an automated email from the ASF dual-hosted git repository.

kenhuuu pushed a commit to branch 3.7-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/3.7-dev by this push:
     new fceffb19f1 Regression: Graceful shutdowns for GremlinServer (#2712)
fceffb19f1 is described below

commit fceffb19f10250d766799036c76a170b44df3846
Author: Daniel Weber <[email protected]>
AuthorDate: Fri Aug 23 00:13:26 2024 +0200

    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.
---
 CHANGELOG.asciidoc                                  |  1 +
 gremlin-server/src/main/bin/gremlin-server.sh       |  2 +-
 gremlin-server/src/main/docker/docker-entrypoint.sh | 10 +---------
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index f70c1c1a70..77968d6d81 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -36,6 +36,7 @@ This release also includes changes from <<release-3-6-8, 
3.6.8>>.
 * 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 41e446be92..b7aebf2513 100755
--- a/gremlin-server/src/main/bin/gremlin-server.sh
+++ b/gremlin-server/src/main/bin/gremlin-server.sh
@@ -209,7 +209,7 @@ startForeground() {
   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 af7050cdad..1b7456ddbc 100755
--- a/gremlin-server/src/main/docker/docker-entrypoint.sh
+++ b/gremlin-server/src/main/docker/docker-entrypoint.sh
@@ -29,12 +29,4 @@ GREMLIN_SERVER=/opt/gremlin-server/bin/gremlin-server.sh
 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 "$@"

Reply via email to