Skip to content

fix(desktop): log WebKitWebProcess termination instead of silent freeze (#4359) - #4360

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/4359-webprocess-terminated
Open

fix(desktop): log WebKitWebProcess termination instead of silent freeze (#4359)#4360
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:fix/4359-webprocess-terminated

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

What

Installs a web-process-terminated handler on the Linux WebKitGTK webview so a renderer (WebKitWebProcess) crash surfaces as a diagnosable log line instead of a silent dead window.

This is the detect + readback half of #4359. The renderer-recovery behavior (auto-reload vs. a "click to restart" affordance) is the one design call flagged in #4359 and is intentionally out of scope here — this PR only makes the crash observable, which is non-controversial and independently useful.

Why

Surfaced by the diagnosis in #4358: when the renderer dies (upstream PipeWire/GStreamer segfault, OOM, or a WebKit bug), the main buzz-desktop process and WebKitNetworkProcess stay alive with no renderer, so the window reads as a freeze — no crash dialog, no log line, no recovery path. WebKitGTK emits a purpose-built web-process-terminated signal; Buzz installed no handler for it (verified: zero references in desktop/src-tauri).

How

  • desktop/src-tauri/src/linux_media.rs: new install_web_process_terminated_handler, a sibling of the existing enable_media_capture. Same idiom — webview.with_webview(|pw| pw.inner()) then a WebViewExt::connect_* call, with the module's eprintln!("buzz-desktop: ...") logging and #[cfg]-gated real impl + no-op stubs.
  • desktop/src-tauri/src/lib.rs: wire it in on_webview_ready, right after enable_media_capture.

The handler logs WebProcessTerminationReason (Crashed / ExceededMemoryLimit / TerminatedByApi), so reports like #4358 gain a concrete reason line instead of an unexplained hang.

Verification / honest caveats

  • Host cargo check --lib and cargo clippy --lib are clean — but on macOS, which compiles the #[cfg(not(target_os = "linux"))] stub, not the real body.
  • The real Linux-cfg body was verified against the webkit2gtk 2.0.2 crate source: connect_web_process_terminated is on WebViewExt (web_view.rs:6240, the same trait that owns the existing connect_permission_request at :5815), #[cfg_attr(docsrs, doc(cfg(feature = "v2_20")))] — enabled by the v2_22 feature pinned in Cargo.toml. Closure signature Fn(&Self, WebProcessTerminationReason) matches.
  • No Linux toolchain is available on this host, so the Linux compile path is not machine-verified locally. It is a single-call sibling to an existing, compiling pattern and should be confirmed by Linux CI.

Testing

  • cargo check --lib (host/macOS stub path)
  • cargo clippy --lib (host/macOS stub path)
  • Linux compile + clippy — deferred to CI (no local Linux toolchain)
  • Manual: kill WebKitWebProcess on a Linux build, confirm the buzz-desktop: WebKitWebProcess terminated (reason: …) line appears

Fixes #4359 (detect + readback half).

…ze (block#4359)

When the WebKitGTK renderer process dies (upstream PipeWire/GStreamer
segfault, OOM, WebKit bug — e.g. block#4358), the main buzz-desktop and
WebKitNetworkProcess processes stay alive with no renderer, so the window
reads as a freeze with no crash dialog and no log output.

WebKitGTK emits web-process-terminated for exactly this case. Install a
sibling handler next to the existing getUserMedia permission hook in
linux_media.rs (wired from lib.rs on_webview_ready) that logs the
WebProcessTerminationReason, so a renderer crash surfaces as a
diagnosable log line. Detect+readback half of block#4359; renderer-recovery
behavior is the design call flagged there and is intentionally left out.

Verified: host cargo check + clippy clean (macOS stub path); the Linux
cfg body uses webkit2gtk 2.0.2 WebViewExt::connect_web_process_terminated
(same trait as the existing connect_permission_request), gated v2_20,
enabled by the pinned v2_22 feature. Linux compile path to be confirmed
by CI.

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Linux/Desktop] Renderer (WebKitWebProcess) crashes surface as silent dead window: install a web-process-terminated handler to log + recover

1 participant