-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pandad: reset safety mode on exit #32103
base: master
Are you sure you want to change the base?
Conversation
637a41e
to
1e32418
Compare
This PR has had no activity for 30 days. It will be automatically closed in 7 days if there is no activity. |
This PR has been automatically closed due to inactivity. Feel free to re-open once activity resumes. |
selfdrive/pandad/pandad.py
Outdated
count = 0 | ||
first_run = True | ||
params = Params() | ||
no_internal_panda_count = 0 | ||
|
||
while True: | ||
while not do_exit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behavior matches pandad.cc's of looping until it gets a SIGTERM signal and then gracefully exiting.
selfdrive/pandad/pandad.py
Outdated
# override manager's immediate SystemExit to allow pandad to exit gracefully | ||
def signal_handler(signum, frame): | ||
nonlocal do_exit | ||
do_exit = True | ||
cloudlog.warning(f"caught signal {signum}, exiting") | ||
|
||
do_exit = False | ||
signal.signal(signal.SIGTERM, signal_handler) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When creating a new Python process with multiprocessing.Process
, it inherits the parent's signal handler. For manager, that is to cause a SystemExit
immediately, which SIGKILLs pandad.cc before it has a chance to react to the SIGTERM and close the relay.
openpilot/system/manager/manager.py
Lines 183 to 184 in e8857a6
# SystemExit on sigterm | |
signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(1)) |
@adeebshihadeh we have two options:
|
This PR has had no activity for 14 days. It will be automatically closed in 3 days if there is no activity. |
6d24edd
to
d49eb66
Compare
allows for restarting the device while onroad without faulting the car