From f96a6608eb63f4c6710c9c2078916655e32cf003 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 4 Apr 2019 13:03:48 -0400 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/27090 Reviewed-By: Ruben Bridgewater Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil --- test/parallel/test-worker-memory.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-worker-memory.js b/test/parallel/test-worker-memory.js index 56b06858ddd93f..db204244a533d7 100644 --- a/test/parallel/test-worker-memory.js +++ b/test/parallel/test-worker-memory.js @@ -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.