You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/08/05 22:29:00 UTC

[jira] [Commented] (TINKERPOP-2950) Dockerized server doesn't close gracefully

    [ https://issues.apache.org/jira/browse/TINKERPOP-2950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17871173#comment-17871173 ] 

ASF GitHub Bot commented on TINKERPOP-2950:
-------------------------------------------

rcbyron commented on PR #2397:
URL: https://github.com/apache/tinkerpop/pull/2397#issuecomment-2270026800

   I'm still having issues with graceful shutdown even with this code.
   
   I use the default scripts/empty-sample.groovy which has:
   ```groovy
   globals << [hook : [
           onStartUp: { LifeCycleHook.Context ctx ->
               ctx.logger.info("Executed once at startup of Gremlin Server.")
           },
           onShutDown: { LifeCycleHook.Context ctx ->
               ctx.logger.info("Executed once at shutdown of Gremlin Server.")
               graph.close()  // <

> Dockerized server doesn't close gracefully
> ------------------------------------------
>
>                 Key: TINKERPOP-2950
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2950
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.5.6, 3.6.4
>            Reporter: Cole Greer
>            Priority: Major
>
> When closing a docker container, docker sends a SIGTERM to the foreground process of the container. Docker will then wait for all processes to terminate. After a timeout (default 10s), if any processes haven't stopped, docker will forcefully kill them.
> In our setup, docker-entrypoint.sh is the foreground process, so SIGTERM is sent to this script when the container is closed. As this script does not have any signal handlers, no signal is ever sent to the jvm running the server (in a background process).
> The only workaround I'm aware of to gracefully shut down the server in docker is to manually send a SIGINT to the jvm process as in:
> {code:bash}
> /opt/gremlin-server $ ps
> PID   USER     TIME  COMMAND
>     1 gremlin   0:00 {gremlin-server.} /bin/bash /opt/gremlin-server/bin/gremlin-server.sh conf/gremlin-server.yaml
>    22 gremlin   0:06 java -Dlogback.configurationFile=file:/opt/gremlin-server/conf/logback.xml -Xms512m -Xmx4096m -cp :/opt/gremlin-server/conf/:/opt/gremlin-server/lib
>    55 gremlin   0:00 /bin/sh
>    61 gremlin   0:00 ps
> /opt/gremlin-server $ kill -INT 22 # PID of the java process (gremlin-server)
> {code}
> I propose that we add handlers to docker-entrypoint.sh which will forward SIGTERM and SIGINT to the server process. The same issue likely applies to gremlin-console as well although it is mitigated as the console has a built in command to close itself.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)