macOS: report a view that can never paint again (replaced GPU process, hung renderer) - #39
Merged
Merged
Conversation
A browser that painted and then could never paint again was taken for an
idle static page, so no event fired and the view stayed frozen with no way
back. Two causes, both seen under memory pressure:
- The GPU process dies. Chromium relaunches it, but off-screen frames never
come back. JS still answers, so nothing looked wrong.
- The renderer hangs. The repaint nudge still produced a frame, because the
browser re-presents its last one, so the sweep never got as far as
declaring a stall.
The liveness sweep now ends such a host, so its sessions get processGone
("crashed") and the consumer recreates them the way it recovers from a
crash:
- A GPU process that started after the host's first frame replaced one that
died. The sweep finds it by its --type=gpu-process argument (it runs as
the generic helper) and reads its start time.
- A visible browser that stops painting is sent a JS ping with the repaint
nudge (eval id UInt32.max, consumed by the plugin). Left unanswered for
15 s (FLUTTER_CEF_HANG_MS), the renderer is hung. A static page answers,
and is pinged at most once per staleness window. A navigation or hiding
the view drops an outstanding ping.
example/lib/wedge_recovery_probe.dart kills the GPU process and stops the
renderer, and checks that an idle static page is left alone. On main both
kills go unreported; with this change, processGone("crashed") arrives in
about 2 s and 27 s.
Windows has no steady-state liveness sweep, so it still lacks this.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Under memory pressure, a CEF view could freeze for good: it stopped painting and no event ever fired, so the embedder never recreated it. In the FlutterFlow desktop app the only way out was to relaunch.
Causes (reproduced by signalling the helper processes)
Fix (macOS plugin only, no new cef_host prebuilt)
The steady-state liveness sweep now ends a host that can never paint again. Its sessions get
processGone("crashed"), and the consumer recreates them through the same path it uses after a real crash.--type=gpu-processargument, since it runs as the generic helper. If that process started after the host's first frame, it is a replacement.UInt32.maxand is consumed by the plugin, so it never reaches Dart. If the ping goes unanswered for 15 s (FLUTTER_CEF_HANG_MS), the renderer counts as hung. A static page answers the ping, and is pinged at most once per staleness window. A navigation, or hiding the view, drops an outstanding ping.Probe:
example/lib/wedge_recovery_probe.dartcrashedcrashed./test/run_liveness_probe_tests.shpasses, including new tests for the ping and GPU start-time policies.Windows has no steady-state liveness sweep, so it is not covered by this change.
🤖 Generated with Claude Code