Skip to content

Commit d3fb28c

Browse files
committed
RPMs: Add timeout to shutdown with KILL signal
If the thread pools of an elasticsearch node cannot be shutdown immediately, a wait of 10 seconds is added. This clashes with the RPM scripts, as by default the init functions wait for 3 seconds for a service to shutdown before a KILL signal is sent, resulting in an unclean shutdown - not from an elasticsearch point of view, but from init system point of view, as some lock files are left around. In order to prevent this the init script as well as the systemd configuration now feature the same timeout than the debian package, which is 20 seconds. The await statement, which causes the 10 second delay can be found in InternalNode.close()
1 parent 0e99082 commit d3fb28c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/rpm/init.d/elasticsearch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ start() {
9595
stop() {
9696
echo -n $"Stopping $prog: "
9797
# stop it here, often "killproc $prog"
98-
killproc -p $pidfile $prog
98+
killproc -p $pidfile -d 20 $prog
9999
retval=$?
100100
echo
101101
[ $retval -eq 0 ] && rm -f $lockfile

src/rpm/systemd/elasticsearch.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p /var/run/elasticsearch/e
1313
LimitNOFILE=65535
1414
# See MAX_LOCKED_MEMORY, use "infinity" when MAX_LOCKED_MEMORY=unlimited and using bootstrap.mlockall: true
1515
#LimitMEMLOCK=infinity
16+
# Shutdown delay in seconds, before process is tried to be killed with KILL (if configured)
17+
TimeoutStopSec=20
1618

1719
[Install]
1820
WantedBy=multi-user.target

0 commit comments

Comments
 (0)