Skip to content

Commit

Permalink
test: fix test-worker-memory.js for large cpu #s
Browse files Browse the repository at this point in the history
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 <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
mhdawson committed Apr 8, 2019
1 parent 93df085 commit f96a660
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/parallel/test-worker-memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ const assert = require('assert');
const util = require('util');
const { Worker } = require('worker_threads');

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

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

Expand Down

0 comments on commit f96a660

Please sign in to comment.