Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/utils/configuration/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { coerce } from 'semver';

import { CHANGELOG_URL, populate } from './templates.mjs';
import { allGenerators } from '../../generators/index.mjs';
import logger from '../../logger/index.mjs';
import { parseChangelog, parseIndex } from '../../parsers/markdown.mjs';
import { enforceArray } from '../array.mjs';
import { leftHandAssign } from '../generators.mjs';
Expand Down Expand Up @@ -33,7 +34,11 @@ export const getDefaultConfig = lazy(() =>
}),
},

threads: cpus().length,
// The number of wasm memory instances is severely limited on
// riscv64 with sv39. Running multiple generators that use wasm in
// parallel could cause failures to allocate new wasm instance.
// See also https://github.com/nodejs/node/pull/60591
threads: process.arch === 'riscv64' ? 1 : cpus().length,
chunkSize: 10,
})
)
Expand Down Expand Up @@ -121,6 +126,14 @@ export const createRunConfiguration = async options => {
merged.threads = Math.max(merged.threads, 1);
merged.chunkSize = Math.max(merged.chunkSize, 1);

if (process.arch === 'riscv64' && merged.threads > 1) {
logger.warn(
`Using ${merged.threads} threads might cause failures when` +
'allocating wasm memory due to insufficient virtual address space' +
'on riscv64 with sv39. Please consider using only a single thread.'
);
}

// Transform global config if it wasn't already done
await transformConfig(merged.global);

Expand Down
7 changes: 4 additions & 3 deletions src/utils/highlighter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ function isCodeBlock(node) {
}

export const highlighter = await createHighlighter({
// s390x machines throw memory issues on WASM builds
// https://github.com/nodejs/node/blob/c9acf345922bd758fbb3f16ee6256aa165260219/test/common/sea.js#L55
wasm: process.arch !== 's390x',
// riscv64 with sv39 has limited virtual memory space, where creating
// too many (>20) wasm memory instances fails.
// https://github.com/nodejs/node/pull/60591
wasm: process.arch !== 'riscv64',
});

/**
Expand Down
Loading