mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-12-01 01:37:08 +03:00
Miscellaneous fixes (#25099)
CI / AMD64 Build (push) Waiting to run
CI / AMD64 Smoke Test (push) Blocked by required conditions
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / AMD64 Smoke Test (push) Blocked by required conditions
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* encode notice ids in notice action urls Notice ids went into the URL raw, so a detector on a repeated device like openvino:GPU#2 had everything after the # dropped as a fragment. The acknowledge, mute, and unhide requests 404'd and the buttons did nothing. The hooks now encode the id. * re-sweep a replaced media volume despite the ownership sentinel The boot sweep skipped whenever the sentinel in /config matched, so wiping or swapping /media/frigate while keeping the config volume left the new root-owned folder unswept and Frigate failed to create /media/frigate/recordings. The sentinel is now honored only when each volume root is still owned by the runtime user. Filesystems that accept chown without applying it (CIFS without setuids) get an unmanaged sentinel after a clean sweep so they don't re-sweep on every boot. * don't seed relative move translation from a status without position * disable relative movement when the camera doesn't report its position * stop at startup when the database location isn't writable The ownership sweep only covers /config and /media/frigate, so a database.path on another volume stayed root-owned after upgrading and Frigate boot-looped on a SQLite error. Frigate now checks the database directory and files before opening them and exits with an error naming the path, the runtime uid/gid, and the new docs section. backup.db is checked only when a migration is about to write it. * add note about explicit detect resolution * track where each camera's detect resolution came from The health tab's stream check told users to set the detect resolution whenever a probe returned no size, even when they had already set it, and a camera running on the 1280x720 fallback after a failed startup probe was never flagged unless the stream check was run by hand. The config now records whether the resolution came from the config, a startup probe, or the fallback, and /api/config exposes it per camera. The stream check skips the probe warning when the resolution is set, a camera on the fallback gets a detect settings warning that also shows on the health tab, and cloning detect from a fallback camera no longer copies the fallback size. * don't strip the fallback detect size when cloning * free tracker state when an object is deregistered deregister() removed the object from tracked_objects, disappeared and track_id_map but left its entries in positions, stationary_box_history and the stationary classifier's four per-object dicts, including a 96x96 anchor crop for every object that went stationary. Every object tracked since the camera process started stayed in memory. deregister() now pops those entries and calls a new StationaryMotionClassifier.forget() to clear the classifier's state. * avoid opencv path leak on recurring image writes OpenCV 4.11's Python bindings keep a reference to every path string passed to cv2.imwrite or cv2.imread (opencv/opencv#28047, fixed in 4.13, which needs numpy 2). Callers that write on every frame or event leaked one string per call for the life of the process, about 8 MB a day from preview frames on two cameras. New write_image and read_image helpers encode and decode in memory and do the file I/O through numpy, so OpenCV never sees the path. Preview frames, review and event thumbnails, face and classification training attempts, and the offline preview frame read now use them.
This commit is contained in:
@@ -57,6 +57,14 @@ const EVENT_NOTICE = {
|
||||
muted_at: null,
|
||||
};
|
||||
|
||||
// a repeated device gets a '#2' suffix, which a raw URL would cut off as a fragment
|
||||
const SUFFIXED_NOTICE = {
|
||||
...EVENT_NOTICE,
|
||||
id: "detector_stuck:openvino:GPU#2",
|
||||
scope: "openvino:GPU#2",
|
||||
params: { detector: "openvino:GPU#2" },
|
||||
};
|
||||
|
||||
test.describe("System — Health tab @medium", () => {
|
||||
test("Health is the default tab and lists notices by severity", async ({
|
||||
frigateApp,
|
||||
@@ -95,19 +103,20 @@ test.describe("System — Health tab @medium", () => {
|
||||
|
||||
for (const action of ["acknowledge", "mute"] as const) {
|
||||
test(`${action} posts and removes the row`, async ({ frigateApp }) => {
|
||||
const path = `/api/notices/${encodeURIComponent(SUFFIXED_NOTICE.id)}/${action}`;
|
||||
await frigateApp.installDefaults({
|
||||
config: RESTREAMED,
|
||||
stats: QUIET_STATS,
|
||||
notices: [EVENT_NOTICE],
|
||||
notices: [SUFFIXED_NOTICE],
|
||||
});
|
||||
|
||||
// the list shrinks after the POST so the refetch shows the row gone
|
||||
let hidden = false;
|
||||
await frigateApp.page.route("**/api/notices", (route) =>
|
||||
route.fulfill({ json: hidden ? [] : [EVENT_NOTICE] }),
|
||||
route.fulfill({ json: hidden ? [] : [SUFFIXED_NOTICE] }),
|
||||
);
|
||||
await frigateApp.page.route(
|
||||
`**/api/notices/detector_stuck/${action}`,
|
||||
(url) => url.pathname.endsWith(path),
|
||||
(route) => {
|
||||
hidden = true;
|
||||
return route.fulfill({ json: { success: true } });
|
||||
@@ -117,11 +126,10 @@ test.describe("System — Health tab @medium", () => {
|
||||
await frigateApp.goto("/system#health");
|
||||
const request = frigateApp.page.waitForRequest(
|
||||
(req) =>
|
||||
req.url().includes(`/api/notices/detector_stuck/${action}`) &&
|
||||
req.method() === "POST",
|
||||
new URL(req.url()).pathname.endsWith(path) && req.method() === "POST",
|
||||
);
|
||||
await frigateApp.page
|
||||
.getByTestId("health-problem-notice:detector_stuck")
|
||||
.getByTestId(`health-problem-notice:${SUFFIXED_NOTICE.id}`)
|
||||
.getByRole("button", {
|
||||
name: action === "mute" ? "Mute" : "Acknowledge",
|
||||
exact: true,
|
||||
@@ -264,8 +272,9 @@ test.describe("System — Health tab @medium", () => {
|
||||
url.searchParams.get("include_hidden") === "true",
|
||||
(route) => route.fulfill({ json: [MUTED_NOTICE] }),
|
||||
);
|
||||
const path = `/api/notices/${encodeURIComponent(MUTED_NOTICE.id)}/hidden`;
|
||||
await frigateApp.page.route(
|
||||
"**/api/notices/model_download_failed:yolo/model.onnx/hidden",
|
||||
(url) => url.pathname.endsWith(path),
|
||||
(route) => route.fulfill({ json: { success: true } }),
|
||||
);
|
||||
await frigateApp.goto("/system#health");
|
||||
@@ -276,11 +285,7 @@ test.describe("System — Health tab @medium", () => {
|
||||
|
||||
const request = frigateApp.page.waitForRequest(
|
||||
(req) =>
|
||||
req
|
||||
.url()
|
||||
.endsWith(
|
||||
"/api/notices/model_download_failed:yolo/model.onnx/hidden",
|
||||
) && req.method() === "DELETE",
|
||||
new URL(req.url()).pathname.endsWith(path) && req.method() === "DELETE",
|
||||
);
|
||||
await frigateApp.page
|
||||
.getByTestId(
|
||||
@@ -1067,6 +1072,76 @@ test.describe("System — Health notices sources @medium", () => {
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("a camera on the fallback detect resolution is flagged", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.installDefaults({
|
||||
config: { cameras: { garage: { detect_resolution_source: "default" } } },
|
||||
stats: QUIET_STATS,
|
||||
});
|
||||
await frigateApp.goto("/system#health");
|
||||
|
||||
const row = frigateApp.page.getByTestId(
|
||||
"health-problem-config:detect:detect-resolution-not-probed:camera.garage",
|
||||
);
|
||||
await expect(row).toBeVisible({ timeout: 15_000 });
|
||||
await expect(row).toHaveAttribute("data-severity", "warning");
|
||||
await expect(
|
||||
frigateApp.page.getByTestId(
|
||||
"health-problem-config:detect:detect-resolution-not-probed:camera.front_door",
|
||||
),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("an unprobeable resolution is only flagged when Frigate must probe it", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
const noSize = [
|
||||
{
|
||||
return_code: 0,
|
||||
stderr: "",
|
||||
stdout: {
|
||||
streams: [
|
||||
{ codec_type: "video", codec_name: "h264" },
|
||||
{ codec_type: "audio", codec_name: "aac" },
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
await frigateApp.installDefaults({
|
||||
config: {
|
||||
cameras: {
|
||||
backyard: { detect_resolution_source: "probed" },
|
||||
front_door: { detect_resolution_source: "default" },
|
||||
},
|
||||
},
|
||||
ffprobe: { backyard: noSize, front_door: noSize, garage: noSize },
|
||||
stats: QUIET_STATS,
|
||||
});
|
||||
await frigateApp.goto("/system#health");
|
||||
|
||||
await frigateApp.page
|
||||
.getByRole("button", { name: "Run stream checks" })
|
||||
.click();
|
||||
|
||||
await expect(
|
||||
frigateApp.page.getByTestId(
|
||||
"health-problem-stream:backyard:0:resolution-unknown",
|
||||
),
|
||||
).toBeVisible({ timeout: 15_000 });
|
||||
await expect(
|
||||
frigateApp.page.getByTestId(
|
||||
"health-problem-stream:garage:0:resolution-unknown",
|
||||
),
|
||||
).toHaveCount(0);
|
||||
// the startup probe's own row already covers this camera
|
||||
await expect(
|
||||
frigateApp.page.getByTestId(
|
||||
"health-problem-stream:front_door:0:resolution-unknown",
|
||||
),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("wizard-only Reolink advice stays off the tab", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
@@ -1281,10 +1356,14 @@ test.describe("System — Health notices sources @medium", () => {
|
||||
|
||||
// the list gains the mute after the POST so the refetch hides the row
|
||||
let muted = false;
|
||||
await frigateApp.page.route(`**/api/notices/${id}/mute`, (route) => {
|
||||
muted = true;
|
||||
return route.fulfill({ json: { success: true } });
|
||||
});
|
||||
const path = `/api/notices/${encodeURIComponent(id)}/mute`;
|
||||
await frigateApp.page.route(
|
||||
(url) => url.pathname.endsWith(path),
|
||||
(route) => {
|
||||
muted = true;
|
||||
return route.fulfill({ json: { success: true } });
|
||||
},
|
||||
);
|
||||
await frigateApp.page.route("**/api/notices/muted_checks", (route) =>
|
||||
route.fulfill({ json: muted ? [{ id, muted_at: NOW }] : [] }),
|
||||
);
|
||||
@@ -1297,8 +1376,7 @@ test.describe("System — Health notices sources @medium", () => {
|
||||
);
|
||||
const request = frigateApp.page.waitForRequest(
|
||||
(req) =>
|
||||
req.url().includes(`/api/notices/${id}/mute`) &&
|
||||
req.method() === "POST",
|
||||
new URL(req.url()).pathname.endsWith(path) && req.method() === "POST",
|
||||
);
|
||||
await row.getByRole("button", { name: "Mute", exact: true }).click();
|
||||
await request;
|
||||
|
||||
Reference in New Issue
Block a user