fix(cef): pace per-host browser creates + retry targetId resolve (shared-host burst-render)#5
Merged
Merged
Conversation
…red-host burst) A burst of opCreateBrowser on one shared cef_host handed its single CEF UI thread a pile of blocking CreateBrowserSync calls that serialized + contended the one shared GPU/Viz accelerated-surface handshake — later browsers got no surface and never painted (blank tile), and their targetId resolve wedged behind the create backlog. Two Swift-side fixes (CefProfileHost): - Per-host create pacing: createSendQueue + pumpCreateQueue send opCreateBrowser one at a time, spaced 0.18s, instead of all at once — each browser's create + surface handshake completes before the next contends the GPU process. Verified live: a 7-cefWebview burst on one shared host now renders all 7 (was 1/7). - resolveTargetId retry: the fire-once 5s probe missed pages that committed late under burst (empty `webview snapshot`). Re-probe every 0.5s up to ~4.5s while still pending — a sibling of the 33858fb fix in the same targetId path. Render is fixed; concurrent multi-tile agent-DRIVING still has a residual relay issue (2nd+ tile's CDP page target not found) tracked separately. Co-Authored-By: Claude Opus 4.8 (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.
Problem
When many browsers are created in a burst on one shared
cef_host(multiple views on one named profile — the P2 multiplex), most render blank. Reproduced live in Campus: a 7-cefWebview burst on one shared host rendered only 1 of 7; agent-driving the rest returned empty.Root cause
Each
opCreateBrowserruns a blockingCreateBrowserSyncon cef_host's single CEF UI thread. A burst hands the UI thread a pile of synchronous creates that serialize and contend the one shared GPU/Viz accelerated-surface handshake — later browsers get no surface and never paint (blank), and their dependent ops (resize-to-heal, targetId resolve) wedge behind the create backlog. 2-per-host always worked; 7-at-once is where it falls over. (The create/present path is unchanged since P2-step1, so this is a pre-existing multi-browser limit, not a step2 regression.)Fix (Swift-side,
CefProfileHost)createSendQueue+pumpCreateQueuesendopCreateBrowserone at a time, spaced 0.18s, so each browser's create + surface handshake completes before the next contends the shared GPU process.resolveTargetIdretry — the fire-once 5s probe missed pages that committed late under burst (emptywebview snapshot); re-probe every 0.5s up to ~4.5s while still pending. Sibling of the 33858fb fix in the same targetId path.Verification
Live, firebase-dev Campus build: a 7-cefWebview burst on one shared host now renders all 7 (was 1/7).
Known follow-up (not in this PR)
Concurrent multi-tile agent-driving still has a residual: only one tile per shared host resolves a drivable CDP page target ("No page found" for the 2nd+). Rendering is fixed; the relay-multiplex page-target exposure is tracked separately.
🤖 Generated with Claude Code