Skip to content

TD-5427: a web view that cannot draw is relaunched without compositing, never left blank - #296

Merged
captcrock merged 4 commits into
mainfrom
td/5427-egl-fallback
Dec 1, 2026
Merged

captcrock merged 4 commits into
mainfrom
td/5427-egl-fallback

Conversation

@captcrock

@captcrock captcrock commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

TD-5427: a web view that cannot draw is relaunched without compositing, never left blank

This comes from a live install. On Linux, when WebKitWebProcess aborts at start ("Could not create default EGL display: EGL_BAD_PARAMETER"), the window used to show only the File/Edit menu and stay blank. Meanwhile the host still logged "connected to tstd".

What it does

  • A paint signal. Two animation frames after mount, the UI sends ui_painted. The host also connects WebKitGTK's web-process-terminated signal directly, because Tauri reports it only on Apple.
  • Detection. If the web process dies, the host acts at once. If no paint arrives within 20 s (TST_DESK_PAINT_TIMEOUT_SECS), it acts then. A healthy start paints in about 1 s. Hidden or minimised windows aren't judged.
  • One relaunch. The host stops tstd and execs itself with WEBKIT_DISABLE_COMPOSITING_MODE=1, because WebKitGTK reads that variable once per process. It relaunches at most once per start; if the variable was already set, it goes straight to the dialog. The updater doesn't carry over a variable the host set.
  • A native dialog, never a blank window. If the relaunch also fails to paint, a dialog names the captured EGL line (a stderr relay keeps the host's own crash output) and the env var that fixes it, and the app exits with code 1. The dialog also points out an EGL vendor override if one is set.
  • Doctor. A display row says when the app relaunched without compositing, and why.
  • The packaged gate. package.yml now requires the painted signal, not just that tstd connected.

Before/after. EGL failures were forced on this machine:

  • Before (main): under both forced failures the window was blank, and the log still said "connected to tstd".
  • After, silent Mesa failure (MESA_GLES_VERSION_OVERRIDE=1.0): the app relaunches and paints.
  • After, missing vendor library: the app relaunches once, then shows the dialog and exits 1.
  • CI replay: in an ubuntu:22.04 container, all three launch steps pass on this branch, and the new gate fails the current release candidate for lacking the ready signal.

What I could not show: disabling compositing did not fix the EGL aborts I could force here. A missing vendor library aborts either way. A Mesa-only override in the packaged 22.04 build on a newer host fails for a separate reason (its libwayland lacks wl_fixes_interface), which may deserve its own story. The live case that compositing-off fixed wasn't reproduced here. Every forced failure now ends in the dialog rather than a blank window.

Open questions for the manager:

  • A web-process crash after the first paint is only logged. Should it relaunch too?
  • A relaunch leaves the old WebKit helpers as zombies until the app quits.

Checks:

  • Rust: clippy -D warnings is clean, and the library tests pass (190).
  • UI: vitest passes (3,322); tsc and the build are clean.
  • Core: the full suite passes (10,195); ruff and mypy are clean.
  • Release scan: 0 hits.
  • Known failure: daemon_supervision's group-kill test fails the same way on main (see AGENTS §12).
  • Not run: no aarch64, macOS or Windows compile was run here.

Review: 2 independent rounds (another account).

  • Round 1 (72c05c3): 3 defects, all reproduced: a failed relaunch left a hidden process that never quit; a % in the dialog text crashed GTK; no window while the relaunch waited for a starting tstd. Fixed in 9866182 (end the process on the dialog's OK, dialog_safe escapes % and strips NULs, a quit during the wait cancels the relaunch).
  • Round 2 (9866182): no new defects; fixes (1) and (2) re-reproduced as fixed. Not verified on the review host: the success path (relaunch, then paint), which its NVIDIA/Xvfb WebKit could not paint either way; the CI paint gate covers it. Unreproduced, contrived: an occluded but mapped window may get no frames for 20 s and relaunch once.

🤖 Generated with Claude Code

captcrock and others added 4 commits December 1, 2026 18:44
On Linux a WebKitGTK web process that aborts at start ("Could not create
default EGL display: EGL_BAD_PARAMETER. Aborting...") left a window with a
menu bar and nothing else, with nothing said, while the host logged that it
had connected to tstd.

The window now sends a ready signal two animation frames after the root
layout mounts. The host acts if WebKitGTK reports the web process dead, or
no signal comes within 20 s while the window is shown: it stops tstd as
Quit does and execs itself once with WEBKIT_DISABLE_COMPOSITING_MODE=1,
which WebKitGTK reads once per process. If that start cannot draw either,
or the variable was already set, a native dialog quotes the log line and the
web process's last graphics error and the app exits with status 1.

The web process inherits the host's stderr, so a small forked relay copies
it on unchanged and keeps the last such line. Doctor gets a display row
through an environment variable on the spawned daemon. Tauri's exit code is
always 0 on Linux, so the failing exit is made by the host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ailure

A blank window also connects to tstd, so the packaged smoke and the
long-used-install gate now require the host's "main window painted" line,
and warn when it only came after a relaunch.

egl-fallback-smoke.sh forces two real failures on the packaged app under
Xvfb: Mesa asked for OpenGL ES 1.0 (silent until compositing is off, so the
relaunch paints) and an EGL vendor file naming a missing library (the web
process aborts either way, so the dialog shows and the app exits 1), plus
the second with the variable already set. package.yml runs it on the Linux
legs, which now install xdotool to close the dialog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Records the four requirements as the story's criteria, the design choices
(including that compositing off does not cure every EGL failure), and what a
person on Linux sees when the window cannot draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, Quit wins over a relaunch

- After a failed relaunch the dialog's OK called request_quit, which does
  nothing once the relaunch began a quit: a hidden process stayed running.
  OK now ends the process with the error code.
- rfd passes the dialog message to GTK as a printf format: a % in the EGL
  variable, a path or the web line crashed it (exit 139). The text is
  escaped (% doubled, NULs stripped) on Linux.
- A tray Quit while the relaunch waited for a starting tstd did nothing and
  the app relaunched anyway; Quit now cancels the relaunch. A tstd still
  starting is never killed (it may be upgrading): the wait stays, disclosed.
- Wayland's missing "minimised" state and the dialog's wording with no EGL
  override are disclosed in DECISIONS.

Tests: dialog text with % and a NUL is shown as written; a Quit during a
relaunch cancels it. The crash and the hidden process need a display to
reproduce; the next review round re-runs them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@captcrock
captcrock merged commit dd2772c into main Dec 1, 2026
10 checks passed
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.

1 participant