Handle SIGINT with forkserver (#18860)

* Pass stopevent from main start

* Share stop event across processes

* preload modules

* remove explicit os._exit call

---------

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
Nicolas Mowen
2025-08-16 10:20:33 -05:00
committed by Blake Blackshear
co-authored by Josh Hawkins
parent e1ee6f010f
commit 542bf05bb8
11 changed files with 68 additions and 46 deletions
+5 -1
View File
@@ -95,8 +95,9 @@ class DetectorRunner(FrigateProcess):
start_time: Value,
config: FrigateConfig,
detector_config: BaseDetectorConfig,
stop_event: MpEvent,
) -> None:
super().__init__(name=name, daemon=True)
super().__init__(stop_event, name=name, daemon=True)
self.detection_queue = detection_queue
self.cameras = cameras
self.avg_speed = avg_speed
@@ -166,6 +167,7 @@ class ObjectDetectProcess:
cameras: list[str],
config: FrigateConfig,
detector_config: BaseDetectorConfig,
stop_event: MpEvent,
):
self.name = name
self.cameras = cameras
@@ -175,6 +177,7 @@ class ObjectDetectProcess:
self.detect_process: FrigateProcess | None = None
self.config = config
self.detector_config = detector_config
self.stop_event = stop_event
self.start_or_restart()
def stop(self):
@@ -202,6 +205,7 @@ class ObjectDetectProcess:
self.detection_start,
self.config,
self.detector_config,
self.stop_event,
)
self.detect_process.start()