Minimal, reproducible example demonstrating broken signal handling for OpenSearch.
-
Build and run the vanilla (default entrypoint) and fixed container.
make run-vanilla make run-fixed
-
Both containers should be up, check the container IDs with
docker ps
.> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 536d57b3aa00 724651c0865b "/tini -- ./opensear…" About a minute ago Up About a minute 9200/tcp, 9300/tcp, 9600/tcp, 9650/tcp eager_spence 8a4f3e9dc88a a0cd42027469 "./opensearch-docker…" About a minute ago Up About a minute 9200/tcp, 9300/tcp, 9600/tcp, 9650/tcp heuristic_turing
-
Send a
SIGTERM
signal to either container and observe different behaviour.# Send a signal to the vanilla container, it will not terminate. make send-sigterm CONTAINER_ID=8a4f # Send a signal to the fixed container, it will terminate. make send-sigterm CONTAINER_ID=536
-
Observe the process trees in both containers (notice
bash
as PID 1 in the vanilla container).Vanilla
[opensearch@8a4f3e9dc88a ~]$ ps -ejf UID PID PPID PGID SID C STIME TTY TIME CMD opensea+ 1 0 1 1 0 16:33 pts/0 00:00:00 /bin/bash ./opensearch-docker-entrypoint.sh opensearch opensea+ 33 1 1 1 2 16:33 pts/0 00:00:08 /usr/share/opensearch/jdk/bin/java -Xshare:auto -Xms4m -Xmx64m -XX:+UseSerialGC -Dlog4j.configurationFile=/usr/share/opensearch/config/opensearch-performance-analyzer/log4j2.xml -Xms64M -Xmx64M -XX:+UseSerialGC -XX:CICompilerCount=1 -XX:-TieredCompilation opensea+ 34 1 1 1 6 16:33 pts/0 00:00:26 /usr/share/opensearch/jdk/bin/java -Xshare:auto -Dopensearch.networkaddress.cache.ttl=60 -Dopensearch.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastTopensea+ 391 0 391 391 0 16:39 pts/1 00:00:00 /bin/sh -c eval $(grep ^$(id -un): /etc/passwd | cut -d : -f 7-) opensea+ 402 391 402 391 0 16:39 pts/1 00:00:00 /bin/bash opensea+ 416 402 416 391 0 16:39 pts/1 00:00:00 ps -ejf
Fixed
[opensearch@191e42e045f7 ~]$ ps -ejf UID PID PPID PGID SID C STIME TTY TIME CMD opensea+ 1 0 1 1 0 16:38 pts/0 00:00:00 /tini -- ./opensearch-docker-entrypoint.sh opensearch opensea+ 7 1 7 1 99 16:38 pts/0 00:00:26 /usr/share/opensearch/jdk/bin/java -Xshare:auto -Dopensearch.networkaddress.cache.ttl=60 -Dopensearch.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastT opensea+ 269 0 269 269 0 16:38 pts/1 00:00:00 /bin/sh -c eval $(grep ^$(id -un): /etc/passwd | cut -d : -f 7-) opensea+ 280 269 280 269 0 16:38 pts/1 00:00:00 /bin/bash opensea+ 294 280 294 269 0 16:38 pts/1 00:00:00 ps -ejf