terser-webpack-plugin icon indicating copy to clipboard operation
terser-webpack-plugin copied to clipboard

fix: ensure that the correct number of CPU cores is obtained within t…

Open isbasex opened this issue 2 years ago • 1 comments

PR Description

Fixes Incorrect CPU Core Count within Docker Container

This PR contains a:

  • [x] bugfix

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.

isbasex avatar Jun 21 '23 15:06 isbasex

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: isbasex (53039b2a95fc102b544ce7a4afa33ebd6128a959)