Make updated more resilient (#1853)

* Add sleep at updated startup

* Mitigate symlink-related FS damage
old-commit-hash: c43df81214
commatwo_master
Jason Young 5 years ago committed by GitHub
parent 4d9200f307
commit 2b60599543
  1. 7
      launch_chffrplus.sh
  2. 5
      selfdrive/updated.py

@ -41,9 +41,12 @@ function launch {
mv $BASEDIR /data/safe_staging/old_openpilot mv $BASEDIR /data/safe_staging/old_openpilot
mv "${STAGING_ROOT}/finalized" $BASEDIR mv "${STAGING_ROOT}/finalized" $BASEDIR
cd $BASEDIR
# The mv changed our working directory to /data/safe_staging/old_openpilot # Partial mitigation for symlink-related filesystem corruption
cd "${BASEDIR}" # Ensure all files match the repo versions after update
git reset --hard
git submodule foreach --recursive git reset --hard
echo "Restarting launch script ${LAUNCHER_LOCATION}" echo "Restarting launch script ${LAUNCHER_LOCATION}"
exec "${LAUNCHER_LOCATION}" exec "${LAUNCHER_LOCATION}"

@ -32,6 +32,7 @@ import signal
from pathlib import Path from pathlib import Path
import fcntl import fcntl
import threading import threading
import time
from cffi import FFI from cffi import FFI
from common.basedir import BASEDIR from common.basedir import BASEDIR
@ -336,6 +337,10 @@ def main():
except IOError: except IOError:
raise RuntimeError("couldn't get overlay lock; is another updated running?") raise RuntimeError("couldn't get overlay lock; is another updated running?")
# Wait a short time before our first update attempt
# Avoids race with IsOffroad not being set, reduces manager startup load
time.sleep(30)
while True: while True:
update_failed_count += 1 update_failed_count += 1
time_wrong = datetime.datetime.utcnow().year < 2019 time_wrong = datetime.datetime.utcnow().year < 2019

Loading…
Cancel
Save