From 4f23eba22fc21efffac671e3ca67fdbfdcd179f7 Mon Sep 17 00:00:00 2001 From: Levi Zim Date: Tue, 11 Nov 2025 22:57:29 +0800 Subject: [PATCH] test: limit the concurrency of WPTRunner for RISC-V For riscv64, the most commonly supported paging mode is sv39, which allocates 256GiB of virtual address space for the user space. However, due to trap handler security mechanism in V8, creating a wasm memory will cost 8GiB of continuous virtual address space. In a fresh node repl, I could only create 27 WebAssembly.Memory instances. When the virtual address space is more fragmented, it is worse. The wpt tests are randomly failing on riscv64 due to insufficient virtual address space to create wasm memories. This PR fixes it by limiting the concurrency of the WPTRunner to prevent the tests from creating too many wasm memories. PR-URL: https://github.com/nodejs/node/pull/60591 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/common/wpt.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/common/wpt.js b/test/common/wpt.js index 5f66969239f..307890e91f1 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -519,6 +519,14 @@ const limit = (concurrency) => { class WPTRunner { constructor(path, { concurrency = os.availableParallelism() - 1 || 1 } = {}) { + // RISC-V has very limited virtual address space in the currently common + // sv39 mode, in which we can only create a very limited number of wasm + // memories(27 from a fresh node repl). Limit the concurrency to avoid + // creating too many wasm memories that would fail. + if (process.arch === 'riscv64' || process.arch === 'riscv32') { + concurrency = Math.min(10, concurrency); + } + this.path = path; this.resource = new ResourceLoader(path); this.concurrency = concurrency;