Skip to content

CI: trace where the wasm smoke test hangs (debug) - #53

Closed
Mnwa wants to merge 3 commits into
mainfrom
ci/wasm-hang-diagnostics
Closed

Mnwa wants to merge 3 commits into
mainfrom
ci/wasm-hang-diagnostics

Conversation

@Mnwa

@Mnwa Mnwa commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Debug PR, not meant to merge as is.

Since the deps refresh in 03ee2a9 the Test (wasm32-wasip1-threads fallback) smoke step hangs on Linux CI every time (main run, release PR #52 and its rerun), printing nothing at all, not even the WASI ExperimentalWarning that the last green run printed within 0.1 s. The same wasm passes on macOS with the same Node 26.13.1, rustc 1.100.0 and deps, so the main thread most likely blocks synchronously before the first tick, on Linux only (the runner also moved from ubuntu-24.04 to ubuntu-26.04).

This PR runs the smoke step through scripts/ci/hang-report.sh with a 120 s deadline:

  • scripts/ci/trace-blocking.cjs is preloaded and writes every JS Atomics.wait, Worker creation and binding/napi-rs/emnapi module load to stderr synchronously, so the last lines name the call that never returned.
  • On a hang it dumps the threads with their kernel wait channels, a Node report through SIGUSR2, and gdb backtraces of every thread, then fails with exit code 124. Reports are uploaded as the wasm-hang-report artifact.
  • The wasm job gets timeout-minutes: 30.

Checked locally: the smoke test passes through the wrapper, exit codes pass through, and a synthetic hang (main thread and a Worker in Atomics.wait) shows both stuck calls with stacks.

🤖 Generated with Claude Code

Mnwa and others added 3 commits November 27, 2026 13:08
Since the late-November deps refresh the wasm smoke test hangs on Linux CI
with no output at all, while it passes on macOS with the same Node, rustc
and wasm. Run it through scripts/ci/hang-report.sh with a 120 s deadline:
a preload writes every JS Atomics.wait, Worker creation and binding module
load to stderr synchronously, and on a hang the script dumps the threads,
a Node report and gdb backtraces of every thread. The job also gets a
30 minute timeout so a deadlock no longer holds the runner for 6 hours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first traced run showed the wasm smoke test does not deadlock: the main
thread spins at 100% CPU in JIT code right after the runtime modules load,
before any Worker exists, and never takes the report interrupt. gdb could
not unwind past frame 0. Run node with --perf-basic-prof, sample the main
thread's frame pointer chain five times, and name each return address
through V8's perf map. The debug build keeps the wasm name section so wasm
frames resolve to Rust functions; the wasm and the perf map are uploaded
with the reports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The traced run put the spinning main thread in wasi-libc's
__pthread_key_delete during module init, walking a thread list whose main
thread entry was never linked. Local builds with the same rustc 1.100 link
Rust's self-contained wasi-libc and call __init_tp before that delete; the
CI wasm links a different libc. Drop the wasi-sdk install to test whether
the SDK's libc is what hangs. Nothing in the wasm build compiles C.

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

Mnwa commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Debug only. The hang is traced to wasi-sdk-29 + rustc 1.100 (wasi-libc __pthread_key_delete spin at init); fixed in #54.

@Mnwa Mnwa closed this Nov 27, 2026
@Mnwa
Mnwa deleted the ci/wasm-hang-diagnostics branch November 27, 2026 10:32
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