Skip to content

doc,lib,src: throw on missing WebAssembly or RX support - #66533

Open
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:fix-jitless
Open

ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:fix-jitless

Conversation

@ShogunPanda

Copy link
Copy Markdown
Contributor

Summary

When WebAssembly or RX memory are not available, eventually due to --jitless, a catchable error is now thrown.

In the docs is also clearly stated that if a feature requires one of the features above, Node.js guarantess no fallback.

Changes

  • Report ERR_WEBASSEMBLY_NOT_SUPPORTED for WASM module imports, including source-phase imports.
  • Introduce ERR_RX_MEMORY_NOT_SUPPORTED for otherwise eligible FFI Fast API functions when the executable-memory probe fails.
  • Diagnose missing RX support after libffi callback allocation fails, preserving platform-specific static trampolines and other FFI errors.
  • Decouple the RX capability probe from Fast API emitter availability.
  • Document capability requirements and fallback limitations, and add jitless and Linux seccomp regression coverage.

Notes

A Undici / Fetch similar change is deferred to a separate upstream change.

Assisted-By: OpenAI:GPT-6.1 Sol <openai/gpt-6.1-sol>

Signed-off-by: Paolo Insogna <paolo@cowtech.it>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/build
  • @nodejs/ffi
  • @nodejs/gyp
  • @nodejs/loaders
  • @nodejs/tsc
  • @nodejs/typescript

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Oct 5, 2026
Comment on lines +6 to +8
if (typeof WebAssembly !== 'undefined') {
skip('WebAssembly is available in jitless mode');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum I don't think we should add that, if V8 makes a change so that wasm is available even with --jitless, I think we definitely want to detect it

@aduh95 aduh95 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % linter failures

@ShogunPanda

Copy link
Copy Markdown
Contributor Author

Undici PR: nodejs/undici#5966

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@codecov

codecov Bot commented Oct 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.96552% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.39%. Comparing base (bbd566d) to head (3afc022).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/ffi/fast.cc 57.14% 6 Missing ⚠️
src/node_ffi.cc 72.72% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66533      +/-   ##
==========================================
- Coverage   92.74%   90.39%   -2.35%     
==========================================
  Files         422      791     +369     
  Lines      193170   276006   +82836     
  Branches    29783    52980   +23197     
==========================================
+ Hits       179160   249507   +70347     
- Misses      13682    16910    +3228     
- Partials      328     9589    +9261     
Files with missing lines Coverage Δ
lib/internal/modules/esm/translators.js 97.57% <100.00%> (+6.03%) ⬆️
src/ffi/fast.h 100.00% <ø> (ø)
src/ffi/jit_memory.cc 89.47% <ø> (ø)
src/node_errors.h 86.95% <ø> (ø)
src/node_ffi.cc 72.62% <72.72%> (ø)
src/ffi/fast.cc 69.95% <57.14%> (ø)

... and 493 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/node_errors.h
V(ERR_OPERATION_FAILED, TypeError) \
V(ERR_OPTIONS_BEFORE_BOOTSTRAPPING, Error) \
V(ERR_OUT_OF_RANGE, RangeError) \
V(ERR_RX_MEMORY_NOT_SUPPORTED, Error) \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\ needs one more character indentation 🤤

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

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants