Bound the watchdogs' docker calls — a hung daemon is what they exist to catch
This commit is contained in:
@@ -210,9 +210,12 @@ _rw_trap_restart_stopped() {
|
||||
[[ ${#_RW_TRAP_STOPPED[@]} -eq 0 ]] && return
|
||||
for c in "${_RW_TRAP_STOPPED[@]}"; do
|
||||
[[ -z "$c" ]] && continue
|
||||
if docker inspect "$c" >/dev/null 2>&1; then
|
||||
# Bounded, because this runs from the EXIT trap. An unbounded docker call here means a
|
||||
# hung daemon stops the script exiting at all — it keeps its lock, and the containers
|
||||
# this trap exists to bring back stay down.
|
||||
if timeout "$DOCKER_TIMEOUT" docker inspect "$c" >/dev/null 2>&1; then
|
||||
warn "Exit trap: restarting $c (stopped but state not persisted)"
|
||||
docker start "$c" >/dev/null 2>&1 || warn " Failed to restart $c"
|
||||
timeout "$DOCKER_TIMEOUT" docker start "$c" >/dev/null 2>&1 || warn " Failed to restart $c"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user