Make sure faulthandler is enabled in all processes

This has no effect currently since we're using the fork start_method.
However, when we inevidably switch to forkserver (either by choice, or
by upgrading to python 3.14+) not having this makes for some really fun
failure modes :D
This commit is contained in:
George Tsiamasiotis 2024-10-03 19:34:23 +03:00
parent abca52e183
commit 8c2f78b411

View File

@ -1,3 +1,4 @@
import faulthandler
import logging import logging
import multiprocessing as mp import multiprocessing as mp
import signal import signal
@ -73,6 +74,8 @@ class Process(BaseProcess):
self.__log_queue = frigate.log.log_listener.queue self.__log_queue = frigate.log.log_listener.queue
def before_run(self) -> None: def before_run(self) -> None:
faulthandler.enable()
def receiveSignal(signalNumber, frame): def receiveSignal(signalNumber, frame):
# Get the stop_event through the dict to bypass lazy initialization. # Get the stop_event through the dict to bypass lazy initialization.
stop_event = self.__dict__.get("stop_event") stop_event = self.__dict__.get("stop_event")