Fix waiting for unkillable process. Fixes #1087 (#1099)

* Fix waiting for unkillable process. Fixes #1087

* Add bugfix to release notes

* Don't pass in exitcode

old-commit-hash: 909efef6af
commatwo_master
Willem Melching 5 years ago committed by GitHub
parent 0fdc995077
commit ee238fc125
  1. 1
      RELEASES.md
  2. 19
      selfdrive/manager.py

@ -3,6 +3,7 @@ Version 0.7.3 (2020-xx-xx)
* Support for 2020 Highlander thanks to che220! * Support for 2020 Highlander thanks to che220!
* Support for 2018 Lexus NX 300h thanks to kengggg! * Support for 2018 Lexus NX 300h thanks to kengggg!
* Speed up ECU firmware query * Speed up ECU firmware query
* Fix bug where manager would sometimes hang after shutting down the car
Version 0.7.2 (2020-02-07) Version 0.7.2 (2020-02-07)
======================== ========================

@ -289,6 +289,15 @@ def prepare_managed_process(p):
subprocess.check_call(["make", "clean"], cwd=os.path.join(BASEDIR, proc[0])) subprocess.check_call(["make", "clean"], cwd=os.path.join(BASEDIR, proc[0]))
subprocess.check_call(["make", "-j4"], cwd=os.path.join(BASEDIR, proc[0])) subprocess.check_call(["make", "-j4"], cwd=os.path.join(BASEDIR, proc[0]))
def join_process(process, timeout):
# Process().join(timeout) will hang due to a python 3 bug: https://bugs.python.org/issue28382
# We have to poll the exitcode instead
t = time.time()
while time.time() - t < timeout and process.exitcode is None:
time.sleep(0.001)
def kill_managed_process(name): def kill_managed_process(name):
if name not in running or name not in managed_processes: if name not in running or name not in managed_processes:
return return
@ -302,18 +311,12 @@ def kill_managed_process(name):
else: else:
running[name].terminate() running[name].terminate()
# Process().join(timeout) will hang due to a python 3 bug: https://bugs.python.org/issue28382 join_process(running[name], 5)
# We have to poll the exitcode instead
# running[name].join(5.0)
t = time.time()
while time.time() - t < 5 and running[name].exitcode is None:
time.sleep(0.001)
if running[name].exitcode is None: if running[name].exitcode is None:
if name in unkillable_processes: if name in unkillable_processes:
cloudlog.critical("unkillable process %s failed to exit! rebooting in 15 if it doesn't die" % name) cloudlog.critical("unkillable process %s failed to exit! rebooting in 15 if it doesn't die" % name)
running[name].join(15.0) join_process(running[name], 15)
if running[name].exitcode is None: if running[name].exitcode is None:
cloudlog.critical("FORCE REBOOTING PHONE!") cloudlog.critical("FORCE REBOOTING PHONE!")
os.system("date >> /sdcard/unkillable_reboot") os.system("date >> /sdcard/unkillable_reboot")

Loading…
Cancel
Save