Skip to content

fix: fail fast when wasm worker bootstrap hangs#13705

Draft
hardfist wants to merge 1 commit intomainfrom
codex/fix-wasm-thread-start-hang
Draft

fix: fail fast when wasm worker bootstrap hangs#13705
hardfist wants to merge 1 commit intomainfrom
codex/fix-wasm-thread-start-hang

Conversation

@hardfist
Copy link
Copy Markdown
Contributor

Summary

This adds waitThreadStart: 1000 to the Node WASM entrypoints so worker bootstrap failures fail fast instead of hanging the process.

Root Cause

@emnapi/wasi-threads does not wait for worker bootstrap by default. If a WASI worker fails after thread-spawn returns but before the worker finishes loading, the caller can continue waiting on a thread that never becomes ready, which shows up in CI as a hang.

This change keeps the fix local and minimal on rspack's side by forcing thread startup to complete within 1 second in both the main WASM entrypoint and nested WASM worker entrypoint.

Impact

  • avoids indefinite hangs in WASM CI when worker bootstrap fails
  • converts the failure mode into a fast timeout/error path
  • does not change the normal success path for worker startup

Validation

  • node --check crates/node_binding/rspack.wasi.cjs
  • node --check crates/node_binding/wasi-worker.mjs
  • local commit hook: pnpm run lint:js

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Apr 14, 2026
@hardfist hardfist changed the title [codex] fix: fail fast when wasm worker bootstrap hangs fix: fail fast when wasm worker bootstrap hangs Apr 14, 2026
@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 49f926a to fix: Revert rstest importFunctionName feature when importDynamic is disabled (#13699) by 9aoy

🎉 Size decreased by 5.34KB from 49.39MB to 49.38MB (⬇️0.01%)

@github-actions
Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 6 projects in monorepo, 6 projects with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB -
react-10k 5.7 MB -
react-1k 826.2 KB -
rome 984.1 KB -
react-5k 2.7 MB -
ui-components 5.0 MB -
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 1.7 MB - -
📄 JavaScript 1.7 MB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.7 MB - -
📄 JavaScript 5.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 826.2 KB - -
📄 JavaScript 826.2 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 984.1 KB - -
📄 JavaScript 984.1 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.7 MB - -
📄 JavaScript 2.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.0 MB - -
📄 JavaScript 4.7 MB - -
🎨 CSS 291.6 KB - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

Generated by Rsdoctor GitHub Action

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 14, 2026

Merging this PR will not alter performance

✅ 28 untouched benchmarks


Comparing codex/fix-wasm-thread-start-hang (49f926a) with main (edb8211)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (817208d) during the generation of this report, so edb8211 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant