Skip to content

OUT_OF_RANGE error when os.availableParallelism returns 1 #160

@lholmquist

Description

@lholmquist

I first noticed this when running the fastify tests. We have a nightly process that takes a few key modules, like fastify, and runs there unit tests on the platforms we support.

We were getting this error consistently:

RangeError [ERR_OUT_OF_RANGE]: The value of "options.concurrency" is out of range. It must be >= 1 && <= 4294967295. Received 0
    at new Test (node:internal/test_runner/test:401:9)
    at createTestTree (node:internal/test_runner/harness:37:16)
    at run (node:internal/test_runner/runner:578:16)
    at runWithTypeScript (file:///opt/app-root/src/code/fastify/node_modules/borp/lib/run.js:237:12)
    at async file:///opt/app-root/src/code/fastify/node_modules/borp/borp.js:150:18 {
  code: 'ERR_OUT_OF_RANGE'

While i don't have direct access to that testing machine to see what the os.availableParallelism function was returning, I was able to reproduce this inside a container. I'm using podman desktop(macos 14.7.5) and i created a new podman machine with just 1 cpu.

Inside the Red Hat build of Node.js container, i made sure that `` returned one, then I cloned fastify, and ran the tests like our nightly process and got the same error.

Below is the log of what i did:

~/develop/mcollina/borp (main*) » podman run -it registry.access.redhat.com/ubi8/nodejs-20:latest /bin/bash
Trying to pull registry.access.redhat.com/ubi8/nodejs-20:latest...
Getting image source signatures
Checking if image destination supports signatures
Copying blob sha256:f2550f70fda076b77de27af53b6bbb475003e583653af071fd0875660b633aa2
Copying blob sha256:de727ee512b5d8fc29b2a94d855d09b084ae13d7182d7d5e411ac9aa43c9a131
Copying blob sha256:39049f27ef6e282921f20ccac04828f6a3b9e1f71fa10b16856718c30f5c058b
Copying config sha256:4082713d89f6ed0e6040c078ba41dfbbfee6da716f302f79f8566a16c0fa2a32
Writing manifest to image destination
Storing signatures
bash-4.4$ node -v
v20.18.2
bash-4.4$ node
Welcome to Node.js v20.18.2.
Type ".help" for more information.
> os.
os.__proto__             os.constructor           os.hasOwnProperty        os.isPrototypeOf
os.propertyIsEnumerable  os.toLocaleString        os.toString              os.valueOf

os.EOL                   os.arch                  os.availableParallelism  os.constants
os.cpus                  os.devNull               os.endianness            os.freemem
os.getPriority           os.homedir               os.hostname              os.loadavg
os.machine               os.networkInterfaces     os.platform              os.release
os.setPriority           os.tmpdir                os.totalmem              os.type
os.uptime                os.userInfo              os.version

> os.availableParallelism()
1
>
(To exit, press Ctrl+C again or Ctrl+D or type .exit)
>
bash-4.4$ git clone https://github.com/fastify/fastify.git
Cloning into 'fastify'...
remote: Enumerating objects: 25913, done.
remote: Counting objects: 100% (261/261), done.
remote: Compressing objects: 100% (165/165), done.
remote: Total 25913 (delta 188), reused 106 (delta 96), pack-reused 25652 (from 4)
Receiving objects: 100% (25913/25913), 8.88 MiB | 3.96 MiB/s, done.
Resolving deltas: 100% (19265/19265), done.
bash-4.4$ cd fastify/
bash-4.4$ npm install

added 947 packages, and audited 948 packages in 1m

301 packages are looking for funding
  run `npm fund` for details

4 vulnerabilities (2 high, 2 critical)

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
npm notice
npm notice New major version of npm available! 10.8.2 -> 11.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.3.0
npm notice To update run: npm install -g [email protected]
npm notice
bash-4.4$ npm run test

> [email protected] test
> npm run lint && npm run unit && npm run test:typescript


> [email protected] lint
> npm run lint:eslint


> [email protected] lint:eslint
> eslint


> [email protected] unit
> borp --reporter=@jsumners/line-reporter --coverage --check-coverage

RangeError [ERR_OUT_OF_RANGE]: The value of "options.concurrency" is out of range. It must be >= 1 && <= 4294967295. Received 0
    at new Test (node:internal/test_runner/test:401:9)
    at createTestTree (node:internal/test_runner/harness:37:16)
    at run (node:internal/test_runner/runner:578:16)
    at runWithTypeScript (file:///opt/app-root/src/code/fastify/node_modules/borp/lib/run.js:237:12)
    at async file:///opt/app-root/src/code/fastify/node_modules/borp/borp.js:150:18 {
  code: 'ERR_OUT_OF_RANGE'
}
bash-4.4$

I have a fix that I will send a PR for

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions