vercel-labs / vercel-labs/native

fix(linux): silent crash on startup due to WindowSourceTooLarge

Open
#43 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Zig
Stars
7.7k
Forks
314
Avg merge
5h
Merged PRs (30d)
13

Description

Was trying to run the webview example on Arch Linux (Niri compositor) and it was crashing immediately on startup with just error: CallbackFailed and no other info.

Took a while to track down because the error was being swallowed. Added logging to RunState.emit and found the actual error: WindowSourceTooLarge.

The webview example's inline HTML is 4230 bytes but max_window_source_bytes is hardcoded to 4096 in src/platform/root.zig. So it fails on app_start and shuts down before the window even appears.

Fixes:

  1. Bump max_window_source_bytes to 8192 in src/platform/root.zig
  2. Log the actual error in RunState.emit instead of silently setting failed = true
  3. Use G_APPLICATION_NON_UNIQUE in gtk_host.c — G_APPLICATION_DEFAULT_FLAGS tries to register on D-Bus which may not be available on all Wayland setups

Note for Arch users: Zig 0.16.0 can't link against GCC 16's crt1.o due to .sframe relocations. Workaround:
bash
sudo objcopy --remove-section=.sframe /usr/lib/crt1.o /usr/lib/crt1.o

That's a Zig issue not a zero-native one.

Environment: Arch Linux, Niri, GCC 16.1.1, Zig 0.16.0, WebKitGTK 6.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/platform/root.zig and trace the webview example's app_start path, then inspect RunState.emit and gtk_host.c. Run the webview example on the affected Linux setup and verify that the larger inline HTML starts successfully, errors are logged rather than swallowed, and the GTK host does not require unavailable D-Bus registration.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, zig
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.