fix: ensure that the correct number of CPU cores is obtained within t… #570
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.
PR Description
Fixes Incorrect CPU Core Count within Docker Container
This PR contains a:
Motivation / Use-Case:
This PR addresses a bug occurring within Docker containers due to an incorrect assumption about the available CPU cores. In the original code,
os.cpus().length
was used to obtain the number of cores. This works fine in most scenarios, but within a Docker container, this would return the number of cores available to the host system, not the limited number allocated to the container itself. This discrepancy leads to creating an excessive number of concurrent threads, which can ultimately result in an out-of-memory (OOM) error.This PR corrects this issue by ensuring that the number of cores reported matches the actual number allocated to the Docker container, preventing the creation of too many threads and subsequent OOM errors.
Breaking Changes:
This PR does not introduce any breaking changes.