Browser will run at 100% if config has no restreams enabled.#22661
Browser will run at 100% if config has no restreams enabled.#22661brontide wants to merge 1 commit intoblakeblackshear:masterfrom
Conversation
The `= {}` destructuring default in useDeferredStreamMetadata created a
new object reference every render while the SWR key was null (during the
2-second defer delay). This triggered an infinite re-render loop through
useCameraLiveMode's useEffect dependency on streamMetadata.
Replace with a module-level EMPTY_METADATA constant for referential
stability.
Upstream bug introduced in blakeblackshear#21072 (97b29d1).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thanks, you'll have to rebase on Are you using go2rtc restreaming for your cameras? It would seem like the loop would only trigger constant re-rendering when |
There was a problem hiding this comment.
| const EMPTY_METADATA: { [key: string]: LiveStreamMetadata } = Object.freeze({}); |
While it isn't critical here (as we don't mutate it), we do freeze the object like this elsewhere in the codebase.
|
Apparently you already merged this 3 weeks ago against dev in #22275 but this runaway loop is still present in master. Please note that this code mirrors what you've already committed 1:1, just bring it back to master so that we don't have the runaway CPU on stable. |
|
Removing the transcoded camera from the config has no effect 100% CPU from endless render bug on image This should be merged with master. |
|
You might have misunderstood. I would expect this to spin with restreaming disabled for a camera. As I mentioned, we don't have any other fixes for |
|
All cameras are connected via go2rtc, I don't know why it claims that restreaming is disabled, I can connect via the go2rtc endpoint easily. |
That's usually caused by naming mismatches. |
|
Is this page still accurate since this is how it's configured. https://docs.frigate.video/configuration/restream#reduce-connections-to-camera |
Yes |
|
Are you indicating that the go2rtc stream names for main must match the defined camera names? Currently every camera is connected to go2rtc for both detection and recording. |
Either that, or your config should be using the https://docs.frigate.video/configuration/live/#setting-streams-for-live-ui |
|
All cameras now have restream enabled, 100% render loop for 2 seconds every time the / is viewed which is not present after patching. If restream is required for proper operation it should be flagged as an error in the config. |
|
No, restreaming is not required, but it's recommended to improve live streaming quality and for other apps like Home Assistant: https://docs.frigate.video/configuration/restream/ |
|
This will affect all deployments where none of the cameras are setup for restream. |
The
= {}destructuring default in useDeferredStreamMetadata created a new object reference every render while the SWR key was null (during the 2-second defer delay). This triggered an infinite re-render loop through useCameraLiveMode's useEffect dependency on streamMetadata.Replace with a module-level EMPTY_METADATA constant for referential stability.
Bug introduced in #21072 (97b29d1).
Proposed change
Type of change
Additional information
AI disclosure
Claude was the debugging agent and wrote the code, we examine a few different code paths but none of them were fruitful. The fix was discovered as a bad data causing an infinite render loop. I reproduced the issue on 0.17.1 and then cherry-picked this fix from my dogfood branch, tested again to confirm the issue was resolved, and then created a PR based on master.
Human reproduced issue, human tested fix, human created PR.
Checklist
enlocale.ruff format frigate)Before
Settings showing the exact build

After with this one patch on master