fix(desktop): guard terminal ResizeObserver against feedback loop#610
Draft
skevetter wants to merge 1 commit into
Draft
fix(desktop): guard terminal ResizeObserver against feedback loop#610skevetter wants to merge 1 commit into
skevetter wants to merge 1 commit into
Conversation
The ResizeObserver callback unconditionally called fit(), refresh(), and the terminalResize IPC on every fire. Since fit() mutates the terminal's dimensions, it could re-fire the observer, sustaining a frame-rate loop that pins the renderer main thread at 100% CPU and freezes the window. Track the last propagated cols/rows and early-return when the grid size is unchanged, so the loop can no longer sustain itself.
✅ Deploy Preview for devsydev canceled.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for images-devsy-sh ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Defensive hardening for the terminal
ResizeObserver. The callback previously calledfitAddon.fit(),term.refresh(), and theterminalResizeIPC unconditionally on every fire. Becausefit()mutates the terminal's dimensions, it can re-fire the observer — the classic ResizeObserver feedback loop that can recompute every frame under an oscillating layout and sustain high CPU.Track the last propagated
cols/rowsand early-return when the grid size is unchanged.fit()still runs so layout stays correct, butrefresh()/IPC only fire on a genuine size change.Notes
Split out of #609 (renderer freeze while streaming logs). This change is unrelated to that freeze and is purely preventive — no confirmed reproduction of a ResizeObserver loop.