fix(cef): auto-disable prewarm webview on Wayland/XWayland to prevent X_ConfigureWindow BadWindow crash#2490
Open
M3gA-Mind wants to merge 1 commit into
Open
Conversation
…inyhumansai#2463) CEF render subprocesses issue X_ConfigureWindow against the prewarm child webview's XWindow before XWayland has fully realized it. The resulting BadWindow error is fatal because it fires in the CEF renderer subprocess — not the main process — so the main-process silent X error handler installed by install_silent_x_error_handler() does not intercept it. Guard: when WAYLAND_DISPLAY is set and OPENHUMAN_CEF_PREWARM is unset, cef_prewarm_enabled() returns false and the prewarm webview is skipped with an explanatory log. Users who explicitly set OPENHUMAN_CEF_PREWARM=1 can opt back in (e.g. when CEF subprocess-level X error handling improves). Adds 7 unit tests for the pure cef_prewarm_enabled() predicate covering default, Wayland auto-disable, explicit enable/disable, and case insensitivity. Closes tinyhumansai#2463
Contributor
📝 WalkthroughWalkthroughThis PR adds a decision helper and startup integration to disable the CEF prewarm webview on Linux Wayland/XWayland, addressing crash ChangesCEF prewarm Wayland auto-disable
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
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
cef_prewarm_enabled(env_override, wayland_display_set)pure predicate that auto-disables the CEF cold-start prewarm webview whenWAYLAND_DISPLAYis set andOPENHUMAN_CEF_PREWARMis not explicitly configured.RunEvent::Readyblock is updated to call the predicate, readingWAYLAND_DISPLAYon Linux and logging the reason for disabling (Wayland auto-guard vs. explicit env var).OPENHUMAN_CEF_PREWARM=1if CEF subprocess-level X error handling improves.Root cause
On Wayland/XWayland (e.g. KDE Plasma 6), the CEF cold-start prewarm child webview (
spawn_cef_prewarm) positions itself at(-20000, -20000)off-screen. CEF's render subprocess issuesX_ConfigureWindowagainst that child webview's XWindow before XWayland has fully realized it, producing a fatalBadWindowerror. The main-process silent X error handler (install_silent_x_error_handler) does not intercept subprocess errors — each CEF subprocess is a separate process with its own (default, fatal) Xlib error handler.Setting
OPENHUMAN_CEF_PREWARM=0fully avoids the crash, confirming the prewarm path is the source.Changes
app/src-tauri/src/lib.rscef_prewarm_enabled()predicate; updateRunEvent::Readyprewarm block; add 7 unit testsTest plan
cargo test --manifest-path app/src-tauri/Cargo.toml -- prewarm— 10 tests pass (7 new)cargo check --manifest-path app/src-tauri/Cargo.toml— cleancargo fmt --manifest-path app/src-tauri/Cargo.toml -- --check— cleanHardware tests (require a Wayland-capable Linux system — not automatable in CI):
WAYLAND_DISPLAYis set, the log shows[cef-prewarm] auto-disabled: WAYLAND_DISPLAY is setand the window stays up indefinitely.WAYLAND_DISPLAY): prewarm spawns normally,[cef-prewarm] hidden warmup webview spawnedis logged.OPENHUMAN_CEF_PREWARM=1on Wayland: explicit opt-in is honored, prewarm spawns.The unit tests for
cef_prewarm_enabled()cover all three branches (default, explicit disable, explicit enable) including the Wayland guard, providing the regression coverage required by the acceptance criteria.Related
Closes #2463