Increase graceful shutdown timeout

This commit is contained in:
Lee moon soo 2015-07-02 11:24:34 -07:00
parent 8c7424a191
commit 4558417518
2 changed files with 16 additions and 8 deletions

View file

@ -101,19 +101,27 @@ function wait_for_zeppelin_to_die() {
local pid
local count
pid=$1
timeout=$2
count=0
while [[ "${count}" -lt 10 ]]; do
timeoutTime=$(date "+%s")
let "timeoutTime+=$timeout"
currentTime=$(date "+%s")
forceKill=1
while [[ $currentTime -lt $timeoutTime ]]; do
$(kill ${pid} > /dev/null 2> /dev/null)
if kill -0 ${pid} > /dev/null 2>&1; then
sleep 3
let "count+=1"
else
forceKill=0
break
fi
if [[ "${count}" == "5" ]]; then
currentTime=$(date "+%s")
done
if [[ forceKill -ne 0 ]]; then
$(kill -9 ${pid} > /dev/null 2> /dev/null)
fi
done
}
function wait_zeppelin_is_up_for_ci() {
@ -187,7 +195,7 @@ function stop() {
if [[ -z "${pid}" ]]; then
echo "${ZEPPELIN_NAME} is not running"
else
wait_for_zeppelin_to_die $pid
wait_for_zeppelin_to_die $pid 40
$(rm -f ${ZEPPELIN_PID})
action_msg "${ZEPPELIN_NAME} stop" "${SET_OK}"
fi
@ -200,7 +208,7 @@ function stop() {
fi
pid=$(cat ${f})
wait_for_zeppelin_to_die $pid
wait_for_zeppelin_to_die $pid 20
$(rm -f ${f})
done

View file

@ -163,10 +163,10 @@ public class RemoteInterpreterProcess implements ExecuteResultHandler {
clientPool.clear();
clientPool.close();
// wait for 3 sec and force kill
// wait for some time (connectTimeout) and force kill
// remote process server.serve() loop is not always finishing gracefully
long startTime = System.currentTimeMillis();
while (System.currentTimeMillis() - startTime < 3 * 1000) {
while (System.currentTimeMillis() - startTime < connectTimeout) {
if (this.isRunning()) {
try {
Thread.sleep(500);