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 <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Levi Zim
2025-11-11 22:57:29 +08:00
committed by GitHub
parent 22a3eb00e8
commit cdc3ca8a7e

View File

@@ -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;