Shutdown hang (#11793)

* intentionally handle queues during shutdown and carefully manage shutdown order

* more carefully manage shutdown to avoid threadlocks

* use debug for signal logging

* ensure disabled cameras dont break shutdown

* typo
This commit is contained in:
Blake Blackshear
2024-06-06 18:54:38 -05:00
committed by GitHub
parent 5b42c91a91
commit b4384a1be3
10 changed files with 93 additions and 33 deletions

View File

@@ -360,6 +360,7 @@ def capture_camera(name, config: CameraConfig, process_info):
stop_event = mp.Event()
def receiveSignal(signalNumber, frame):
logger.debug(f"Capture camera received signal {signalNumber}")
stop_event.set()
signal.signal(signal.SIGTERM, receiveSignal)
@@ -446,6 +447,12 @@ def track_camera(
region_grid,
)
# empty the frame queue
logger.info(f"{name}: emptying frame queue")
while not frame_queue.empty():
frame_time = frame_queue.get(False)
frame_manager.delete(f"{name}{frame_time}")
logger.info(f"{name}: exiting subprocess")