Cole Greer created TINKERPOP-2950:
-------------------------------------
Summary: 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.6.4, 3.5.6
Reporter: Cole Greer
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)