fix(pool): vm pools to respect cgroupsv2 memory limit - #10721
Merged
Merged
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
When determining memory based on a percentage of the total available, use the constrained memory value if present to avoid OOM in scenarios where the process has been restricted to less memory than the host physically has.
milas
force-pushed
the
milas/cgroups-memlimit
branch
from
July 6, 2026 19:31
e9386f6 to
ec36219
Compare
AriPerkkio
approved these changes
Jul 15, 2026
AriPerkkio
left a comment
Member
There was a problem hiding this comment.
Looks good to me. @hi-ogawa are you familiar with process.constrainedMemory?
hi-ogawa
approved these changes
Jul 15, 2026
hi-ogawa
left a comment
Collaborator
There was a problem hiding this comment.
Didn't know the API but it makes sense to me. Just skimmed doc https://nodejs.org/api/process.html#processconstrainedmemory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When determining memory based on a percentage of the total available, use the constrained memory value if present to avoid OOM in scenarios where the process has been restricted to less memory than the host physically has.
For example, if running tests in a Kubernetes pod, the container resource requets/limits are used to configure the cgroupsv2 namespace. Exceeding this will result in being OOM killed.
Vitest might see that it's scheduled on a node with 128GiB of RAM even though the container itself has been limited to 4GiB.
It will then allow each worker to have 1/N * 128Gi instead of 1/N * 4Gi of memory.
This can quickly result in an OOM situation, requiring manually setting the
vmMemoryLimitandmaxWorkersin the conf.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
processstuff. I'm happy to give it a shot if given guidance on preferred approach from a maintainer.pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.featbut feel free to retitle asfixif desired!