Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2950

Dockerized server doesn't close gracefully

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.5.6, 3.6.4
    • None
    • server
    • None

    Description

      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:

      /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)
      

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              colebq Cole Greer
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: