Skip to content

fork: size continuation save buffers from live frames#862

Open
brandonpayton wants to merge 1 commit into
fork-save-buffer-truthful-failurefrom
fork-save-buffer-elastic
Open

fork: size continuation save buffers from live frames#862
brandonpayton wants to merge 1 commit into
fork-save-buffer-truthful-failurefrom
fork-save-buffer-elastic

Conversation

@brandonpayton

Copy link
Copy Markdown
Member

Summary

This completes the elastic fork-save-buffer fix on top of #845. PR #845 turns fixed-buffer overruns into truthful failures; this PR prevents the GTK/LXDE overrun by letting opted-in fork-instrumented programs expose a live frame-byte counter and by giving those programs a larger host-reserved fork-save region.

Changes:

  • adds opt-in wasm-fork-instrument --frame-counter and exports _wpk_fork_active_bytes only for flagged programs
  • maintains the counter inside the NORMAL/UNWIND/REWIND state machine for both instrumentation schemes
  • preserves host-parsed marker exports (__abi_version, __wasm_posix_thread_slots, __get_channel_base_addr) so instrumented GTK apps still pass pre-start ABI checks
  • reserves/propagates an elastic fork-save region for frame-counter programs across browser, Node, process, fork, and thread paths
  • wires WASM_POSIX_FORK_FRAME_COUNTER=1 into the fork instrumentation wrapper for GTK/LXDE fork-heavy builds
  • bumps ABI to 17 and updates the ABI snapshot/generated host constants/docs

Validation

Final branch checks:

  • bash scripts/dev-shell.sh bash -c 'cargo test -p fork-instrument --target $(rustc -vV | awk '\''/^host/{print $2}'\'')'
  • bash scripts/dev-shell.sh bash scripts/build-fork-instrument-tool.sh
  • bash scripts/dev-shell.sh bash -c 'bash scripts/check-abi-version.sh && npm --prefix host run typecheck'
  • git diff --check

LXDE validation against the failing software:

  • Validation worktree: /Users/brandon/emdash/worktrees/Kandelo/emdash/_lxde-elastic-validate
  • Rebuilt Xfbdev plus GTK/LXDE openbox, pcmanfm, lxpanel, and leafpad against ABI 17; openbox/pcmanfm/lxpanel were rebuilt with WASM_POSIX_FORK_FRAME_COUNTER=1.
  • Restored libfm's GLib g_spawn_async(..., G_SPAWN_SEARCH_PATH, ...) double-fork path for the validation cache.
  • Verified rebuilt artifacts: openbox/pcmanfm/lxpanel report ABI 17 and export _wpk_fork_active_bytes.
  • Ran bash scripts/dev-shell.sh node scripts/validate-lxde-fork-browser.mjs: BrowserKernel + Xfbdev + openbox + lxpanel + pcmanfm started, lxpanel Menu -> Text Editor spawned a second leafpad through the double-fork path (leafpad count 1 -> 2), and no forkSaveBufferOverrun, save-buffer overflow, or worker-never-start diagnostics were emitted.

Earlier branch validation before the final marker-export carveout:

  • bash scripts/build-musl.sh
  • bash build.sh
  • focused host fork/spawn/thread Vitest slice
  • browser worker/adapter Vitest slice
  • focused libc fork/process slice
  • focused POSIX signal-adjacent slice
  • Chromium browser-demo lazy-registration smoke

Not measured in this PR: final real-world performance overhead for lxpanel with vs. without --frame-counter.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Phase B-1 matrix build status — pr-862-staging

ABI v17. 11 built, 57 failed, 68 total.

Package Arch Status Sha
libcurl wasm32 built 83c7331a
libcxx wasm32 built 2f85dbef
libcxx wasm64 built 9c79648f
libpng wasm32 built 3d47436d
libxml2 wasm32 built f57e4ebf
libxml2 wasm64 built d7bb9f55
openssl wasm32 built 37ca91fe
openssl wasm64 built 9bbc9fce
sqlite wasm32 built a3f0308c
sqlite wasm64 failed
zlib wasm32 built 48858a3b
zlib wasm64 built 7c8161b5
bc wasm32 failed
bzip2 wasm32 failed
coreutils wasm32 failed
curl wasm32 failed
dash wasm32 failed
diffutils wasm32 failed
dinit wasm32 failed
fbdoom wasm32 failed
file wasm32 failed
findutils wasm32 failed
gawk wasm32 failed
git wasm32 failed
grep wasm32 failed
gzip wasm32 failed
hello wasm32 failed
kandelo-sdk wasm32 failed
kernel wasm32 failed
less wasm32 failed
lsof wasm32 failed
m4 wasm32 failed
make wasm32 failed
mariadb wasm32 failed
mariadb wasm64 failed
modeset wasm32 failed
msmtpd wasm32 failed
nano wasm32 failed
ncurses wasm32 failed
netcat wasm32 failed
nginx wasm32 failed
php wasm32 failed
posix-utils-lite wasm32 failed
sed wasm32 failed
spidermonkey wasm32 failed
tar wasm32 failed
tcl wasm32 failed
unzip wasm32 failed
userspace wasm32 failed
vim wasm32 failed
wget wasm32 failed
xz wasm32 failed
zip wasm32 failed
zstd wasm32 failed
bash wasm32 failed
mariadb-test wasm32 failed
mariadb-vfs wasm32 failed
mariadb-vfs wasm64 failed
nethack wasm32 failed
node wasm32 failed
spidermonkey-node wasm32 failed
vim-browser-bundle wasm32 failed
nethack-browser-bundle wasm32 failed
rootfs wasm32 failed
shell wasm32 failed
lamp wasm32 failed
node-vfs wasm32 failed
wordpress wasm32 failed

Auto-generated; replaced on each push. Raw data in the publish-status workflow artifact.

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