jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: Jest in a container over-estimates available resources

Open robert-smith-maersk opened this issue 7 months ago • 1 comments

Version

29.7.0

Steps to reproduce

Run Jest in a container.

Expected behavior

Jest will establish available resources in the container and configure itself appropriately e.g.

    "maxConcurrency": 5,
    "maxWorkers": 1,

Actual behavior

Jest appears to allocate resource based on the host machine specs e.g.

"maxConcurrency": 5,
    "maxWorkers": 31,

Which results in the container being OoM killed.

Additional context

No response

Environment

The container spec is:

        resources:
          requests:
            memory: "8Gi"
            cpu: "2"
            ephemeral-storage: "20Gi"
          limits:
            memory: "8Gi"
            cpu: "2"
            ephemeral-storage: "20Gi"


However envinfo reports:


  System:
    OS: Linux 5.15 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (32) x64 AMD EPYC 7763 64-Core Processor
  Binaries:
    Node: 20.19.1 - ~/_work/_tool/node/20.19.1/x64/bin/node
    npm: 10.8.2 - ~/_work/_tool/node/20.19.1/x64/bin/npm
  npmPackages:
    jest: ^29.7.0 => 29.7.0

robert-smith-maersk avatar May 15 '25 09:05 robert-smith-maersk

My understanding is that Node's os.availableParallelism is supposed to solve this, which is what Jest uses as of v29.4.0 (https://github.com/jestjs/jest/pull/13738). But maybe there's something else going on?

lencioni avatar May 29 '25 16:05 lencioni

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Jun 28 '25 17:06 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] avatar Jul 28 '25 17:07 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] avatar Jul 28 '25 17:07 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

github-actions[bot] avatar Aug 28 '25 00:08 github-actions[bot]