Skip to content

Browser harness: set the thread pool's arming timeout and report how many threads armed - #23

Merged
TJKoury merged 3 commits into
mainfrom
browser-pool-probe-timeout
Nov 16, 2026
Merged

TJKoury merged 3 commits into
mainfrom
browser-pool-probe-timeout

Conversation

@TJKoury

@TJKoury TJKoury commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

In a browser, a pool worker that has not reported ready within 1.5 s is dropped and the module runs on the rest. Under machine load a host that asked for 8 threads got 2, and nothing told it. createWasiThreadSpawn already takes probeTimeoutMs; createBrowserModuleHarness did not forward it.

What changes

  • The harness takes wasiThreadProbeTimeoutMs and forwards it for the initial and the per-command thread contexts. The default stays 1.5 s. A value that is not a positive finite number is refused before any worker is created.
  • The harness exposes a frozen, read-only wasiThreadPoolReport taken from the pool's own ledger: the threads asked for (requested) and the threads that armed (armed). Arming fewer than asked does not throw; the host decides.
  • A worker that misses the timeout is terminated, as before (verified; no leak).
  • Types in src/index.d.ts; docs/isomorphic-pthreads.md documents the option and the report; a changelog line under 0.10.3. No version change.

Tested in Chromium on the SDK's thread-wave module, on the direct and the command surface: with a 30 s timeout 4 of 4 threads arm; with a 1 ms timeout none arm, the report says so, every declined stripe runs on the calling thread and the output is identical to the one-thread output; no worker is alive after destroy; invalid values are refused. No assertion on timing. Firefox and WebKit were not run.

Not from this change, measured for the release

  • test/browser-reachable-node-builtins.test.js fails at the released tag v0.10.2 exactly as on main: the root entry and ./runtime-host reach node:crypto, node:fs, node:fs/promises, node:os and node:path through the FlatSQL package entry.
  • The JSON-boundary scan is within its baseline at v0.10.2 and counts three new JSON calls on main, in src/compiler/compileModule.js and src/compiler/guestLinkLibraries.js; they fail the landing check here as on main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PT7jJcdnhrPX14f8BuYuZy

TJKoury and others added 3 commits November 16, 2026 15:12
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
@TJKoury
TJKoury merged commit 5dd759b into main Nov 16, 2026
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