diff --git a/docs/docs/troubleshooting/edgetpu.md b/docs/docs/troubleshooting/edgetpu.md index f58112801..f5cb3587f 100644 --- a/docs/docs/troubleshooting/edgetpu.md +++ b/docs/docs/troubleshooting/edgetpu.md @@ -46,6 +46,17 @@ Some users have reported that this older device runs an older kernel causing iss 6. Open the control panel - info scree. The coral TPU will now be recognised as a USB Device - google inc 7. Start the frigate container. Everything should work now! +### QNAP NAS + +QNAP NAS devices, such as the TS-253A, may use connected Coral TPU devices if [QuMagie](https://www.qnap.com/en/software/qumagie) is installed along with its QNAP AI Core extension. If any of the features—`facial recognition`, `object recognition`, or `similar photo recognition`—are enabled, Container Station applications such as `Frigate` or `CodeProject.AI Server` will be unable to initialize the TPU device in use. +To allow the Coral TPU device to be discovered, the you must either: + +1. [Disable the AI recognition features in QuMagie](https://docs.qnap.com/application/qumagie/2.x/en-us/configuring-qnap-ai-core-settings-FB13CE03.html), +2. Remove the QNAP AI Core extension or +3. Manually start the QNAP AI Core extension after Frigate has fully started (not recommended). + +It is also recommended to restart the NAS once the changes have been made. + ## USB Coral Detection Appears to be Stuck The USB Coral can become stuck and need to be restarted, this can happen for a number of reasons depending on hardware and software setup. Some common reasons are: diff --git a/frigate/app.py b/frigate/app.py index decee9504..cc596a98a 100644 --- a/frigate/app.py +++ b/frigate/app.py @@ -73,6 +73,7 @@ from frigate.track.object_processing import TrackedObjectProcessor from frigate.util.builtin import empty_and_close_queue from frigate.util.image import SharedMemoryFrameManager, UntrackedSharedMemory from frigate.util.object import get_camera_regions_grid +from frigate.util.services import set_file_limit from frigate.version import VERSION from frigate.video import capture_camera, track_camera from frigate.watchdog import FrigateWatchdog @@ -632,6 +633,9 @@ class FrigateApp: # Ensure global state. self.ensure_dirs() + # Set soft file limits. + set_file_limit() + # Start frigate services. self.init_camera_metrics() self.init_queues() diff --git a/frigate/util/services.py b/frigate/util/services.py index 137e3aa20..94e6692b9 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -5,6 +5,7 @@ import json import logging import os import re +import resource import signal import subprocess as sp import traceback @@ -751,3 +752,19 @@ def process_logs( log_lines.append(dedup_message) return len(log_lines), log_lines[start:end] + + +def set_file_limit() -> None: + # Newer versions of containerd 2.X+ impose a very low soft file limit of 1024 + # This applies to OSs like HA OS (see https://github.com/home-assistant/operating-system/issues/4110) + # Attempt to increase this limit + soft_limit = int(os.getenv("SOFT_FILE_LIMIT", "65536") or "65536") + + current_soft, current_hard = resource.getrlimit(resource.RLIMIT_NOFILE) + logger.debug(f"Current file limits - Soft: {current_soft}, Hard: {current_hard}") + + new_soft = min(soft_limit, current_hard) + resource.setrlimit(resource.RLIMIT_NOFILE, (new_soft, current_hard)) + logger.debug( + f"File limit set. New soft limit: {new_soft}, Hard limit remains: {current_hard}" + )