Open btrudgill opened 3 months ago
came here looking for a reported issue, i am seeing similar behavior. It seems like it is happening more often to me (at least 50%)
This is because either the integration, or the Frigate backend, is returning an error to the card for some reason. I'd start by checking your Home Assistant logs and seeing if there's a log entry that aligns with the time you receive this message and you may get a clue. The request is likely triggered by fetching events/thumbnails, disabling the thumbnails would be a way to avoid the request being sent (and thus the errors being received).
This is the error log that is shown in HA, I don't know if there's a way of getting more detailed logs/info?
This error originated from a custom integration.
Logger: custom_components.frigate.api
Source: custom_components/frigate/api.py:244
Integration: Frigate (documentation, issues)
First occurred: 2:04:59 PM (1 occurrences)
Last logged: 2:04:59 PM
Timeout error fetching information from http://192.168.1.61:5005/api/events?cameras=doorbell&limit=50&include_thumbnails=0:
Sure, disabling the thumbnails/events may get rid of the error, but it isn't a fix to the issue.
i run my frigate separate from HA. on the frigate side it is returning http 499
frigate | 2024-02-28 16:49:09.424868720 192.168.0.24 - - [28/Feb/2024:16:49:09 -0700] "GET /api/events?cameras=driveway-cam&limit=50&has_snapshot=1&include_thumbnails=0 HTTP/1.1" 499 0 "-" "HomeAssistant/2024.2.4 aiohttp/3.9.3 Python/3.12" "-"
in my case, it also crashes my camera feeds
frigate | 2024-02-28 16:49:58.577091561 2024/02/28 16:49:58 [error] 146#146: *71483 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.0.24, server: , request: "GET /api/events?cameras=hagdrivewaycam&limit=50&has_snapshot=1&include_thumbnails=0 HTTP/1.1", upstream: "http://127.0.0.1:5001/events?cameras=hagdrivewaycam&limit=50&has_snapshot=1&include_thumbnails=0", host: "frigate.featherstone.xyz:15000"
and it seems to cause insane i/o (frigate isnt logging anything helpful during this i/o load)
i only experience this i/o load when i hit the frigate haas card. I have three instances of the card on my dashboard (three separate cameras). Frigate will never recover if i leave the haas card open. Once the dashboard/card is closed, frigate returns to normal.
The frigate logs show that there are several calls made from the haas card. Looks like 4 separate calls for each camera within about 3 seconds. I ran a watch command with a 0.1 timer
❯ watch -n 0.1 curl "http://a.b.xyz/api/events?cameras=driveway-cam&limit=50&has_snapshot=1&include_thumbnails=0"
and this also caused my i/o instantly. maybe this is an underlying frigate issue responding to several quick api calls
edit: is it possible to limit how many events the card pulls in from frigate?
edit: is it possible to limit how many events the card pulls in from frigate?
Yes:
performance:
features:
media_chunk_size: 5 // <------------- Default 50
You can also disable thumbnails entirely. Take a look at this issue (https://github.com/dermotduffy/frigate-hass-card/issues/1304), it could be related. Do you see the duplicate log entries in your nginx log as that reporter shows?
changing media_chunk_size on mine to 10 seems to stop it throwing an error.
Trying to look at the nginx logs but they seem a mess on my browser at work, will check when I get home. The user in that issue looks to have a better viewer for the logs? Is there a way to view them that isn't the default 'logs' section in Frigate?
Edit: it seems like changing the media chunk size to 10 hasn't solved the issue, I still get the errors.
Having same issue. Reduced to 5 and still getting this message.
I am getting this issue as well. Apparently it takes only a single occurrence of a failed API call to make the card crash.
This error originated from a custom integration.
Logger: custom_components.frigate.api
Source: custom_components/frigate/api.py:259
integration: Frigate (documentation, issues)
First occurred: 5:35:19 PM (1 occurrences)
Last logged: 5:35:19 PM
Error fetching information from http://cameranuc.local:5000/api/stats: Cannot connect to host cameranuc.local:5000 ssl:default [Invalid argument]
When I cut and paste the /api/stats URL into a browser, I get the correct JSON response as you would expect. Continuous pings from the HA server to the Frigate server during the time of the failure do not show any disconnects, and the Frigate server does not show any errors in the Frigate, Go2rtc or Nginx logs. Only 200 OK replies from the endpoint.
I also had VLC running a stream from the same Go2rtc as the Frigate card, and it continues to run correctly at the same time that Frigate card failed. This combined with the "invalid argument "card error log leads me to believe it's something in the card code itself causing the issue. The card eventually recovers the video stream on its own, but the stream could be down anywhere from a few seconds to several minutes.
I already reduced my media chunk size to 10, so that's not the issue.
I’ve been trying to get to the bottom of this issue for a couple of month now. I really believe this is a SQLite issue not being able to respond to the queries in time the frigate-has-card sends it to the server . And for some reason it halts the frigate server and restart the entire docker container .
Frequent vacuuming (daily reboots) may improve the SQLite . Another way I have manage to improve SQLite response is by sending an event request to the frigate server for each camera every hour. This for some reason improves the response time for each query… it does not completely solves it but at least is something …
I've got one page where I have 6 cards on it, all displaying a live feed with a 5 chunk. When I load the page, it shows the feed for a split second and then they all crash. If I set the chunk to zero, they display fine. Is there any way to lazy load these images / events? I wonder if them all hitting the server at once is killing it.
I've got one page where I have 6 cards on it, all displaying a live feed with a 5 chunk. When I load the page, it shows the feed for a split second and then they all crash. If I set the chunk to zero, they display fine. Is there any way to lazy load these images / events? I wonder if them all hitting the server at once is killing it.
Currently your best bet is to disable the thumbnails while on live view by disabling the thumbnails while live viewing, you can always access the event list by clicking on the event button.
live: controls: thumbnails: mode: none
also creating an automation to send a request to the server per camera will also helps the SQLite response time.
In your HA configuration.yaml file add shell commands as:
shell_command: refresh_frigate_events_camera_name_x : 'curl -k -X GET "http://frigate_ip:5000/events?cameras=camera_name_x"' refresh_frigate_events_camera_name_y : 'curl -k -X GET "http://frigate_ip:5000/events?cameras=camera_name_y"' refresh_frigate_events_camera_name_z : 'curl -k -X GET "http://frigate_ip:5000/events?cameras=camera_name_z"'
Then create an automation in HA that runs on a time pattern as:
` alias: Refresh Frigate Events Database Table per Camera description: Refresh Frigate Events Database Table per Camera trigger:
Give enough time between request for frigate's SQLite to respond to the request that has been sent by the automation. If you notice that accessing events for certain cameras are taking longer than 15 seconds then increase the delay for each request inside your ha automation.
Just started getting this. Removing thumbnails and reducing chunk size down to 2 hasn't helped. It logs that timeout very quickly.
HA log
2024-05-07 16:33:34.526 ERROR (MainThread) [custom_components.frigate.api] Timeout error fetching information from http://homeassistant.local:5000/api/events?cameras=driveway&limit=2&include_thumbnails=0:
Frigate nginx log (seems happy)
2024-05-07 16:33:34.741711164 172.20.0.1 - - [07/May/2024:16:33:34 -0400] "GET /api/events?cameras=driveway&limit=2&include_thumbnails=0 HTTP/1.1" 200 0 "-" "HomeAssistant/2024.4.4 aiohttp/3.9.5 Python/3.12" "-"
Chunk size 0 seems to be working so far.
ADD: I am not seeing the duplicate log entries of #1304. I do see the error with chunk size 1. Quite frequently now. I had been running nearly a year without any config related to retaining recordings or events. So I hypothesized that the database may have become quite large. I've added some config to retain only 30 days, but I don't see any evidence in the logs that expiration is running (logger/logs/frigate.event: debug). Updated Frigate to 0.13.2 and still see the error.
ADD: In some cases I see this error on screen and the error above in the HA log, yet the Frigate nginx log does not show any access to an "events" URL at all, nor does the log of the Apache server which is the reverse proxy fronting Frigate. Odd.
ADD: Then one day the problem just vanished.
ADD: And it's back again ... and there was a 499 in the nginx log this time.
Checklist:
Release with the issue: 5.2.0 Last working release (if known):
Browser and Operating System: Firefox, home assistant mobile app (ios and android).
Description of problem:
Probably 50% of the time when I check my cameras, the events do not load (the side tab thing does not show up) and after a few seconds I get the error message shown below.
Frigate version: 0.13.2-6476f8a
Frigate card diagnostic information This is the error I am getting on the card when the events fail to load:
Javascript errors shown in the web inspector (if applicable):
Additional information:
Frigate config included in case it is useful.