NodeJS Builds or Test Suites Fail With ENOMEM or a Timeout

A common issue with running NodeJS test suites that spawn workers/threads in a Docker container is that these scripts will spawn too many workers/threads and cause excessive memory usage. In most cases this will cause jobs to fail with ENOMEM errors.

This happens because the script looks at the number of CPUs available on the physical machine, which can be 32+ cores, rather than the number vCPUs the Docker container has been allocated.

The number of workers/threads your test suites uses will need to be configured to not exceed the number of vCPUs allocated to the resource class in use (medium by default).

For example, if using Jest, set the maxWorkers option:

Was this article helpful?
22 out of 33 found this helpful



Article is closed for comments.