Skip to content

Commit f96a660

Browse files
committed
test: fix test-worker-memory.js for large cpu #s
This test consistently failed on a system with a large number of cores (~120). Cap the number of concurrent workers so we'll stay consistently within the "slack" allowed with respect to rss. PR-URL: #27090 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
1 parent 93df085 commit f96a660

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/parallel/test-worker-memory.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ const assert = require('assert');
44
const util = require('util');
55
const { Worker } = require('worker_threads');
66

7-
const numWorkers = +process.env.JOBS || require('os').cpus().length;
7+
let numWorkers = +process.env.JOBS || require('os').cpus().length;
8+
if (numWorkers > 20) {
9+
// Cap the number of workers at 20 (as an even divisor of 60 used as
10+
// the total number of workers started) otherwise the test fails on
11+
// machines with high core counts.
12+
numWorkers = 20;
13+
}
814

915
// Verify that a Worker's memory isn't kept in memory after the thread finishes.
1016

0 commit comments

Comments
 (0)