From a08efd14509aa21ef5a43d24621262ef5bc15aa3 Mon Sep 17 00:00:00 2001 From: Levi Zim Date: Wed, 5 Nov 2025 21:08:14 +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. --- test/common/wpt.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/common/wpt.js b/test/common/wpt.js index 6c9a75e4e4cc53..227734171f9121 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -533,6 +533,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;