Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid hangs on many-core Windows machines #7035

Merged
merged 8 commits into from Jun 25, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/whatsnew/2/2.15/index.rst
Expand Up @@ -94,3 +94,6 @@ Internal changes
let the functional test fail with a default value.

Refs #6891

* Fixed an issue where many-core Windows machines (>~60 logical processors) would hang when
using the default jobs count.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to backport that in 2.14.4 :)

3 changes: 2 additions & 1 deletion pylint/lint/base_options.py
Expand Up @@ -244,7 +244,8 @@ def _make_linter_options(linter: PyLinter) -> Options:
"short": "j",
"default": 1,
"help": "Use multiple processes to speed up Pylint. Specifying 0 will "
"auto-detect the number of processors available to use.",
"auto-detect the number of processors available to use, and will cap "
"the count on Windows to avoid hangs.",
},
),
(
Expand Down
5 changes: 5 additions & 0 deletions pylint/lint/run.py
Expand Up @@ -82,6 +82,11 @@ def _cpu_count() -> int:
cpu_count = multiprocessing.cpu_count()
else:
cpu_count = 1
if sys.platform == "win32":
# Using too many child processes in Python 3 hits either hangs or a
# ValueError exception, and, has diminishing returns. Clamp to 56 to
# give margin for error.
cpu_count = min(cpu_count, 56)
randomascii marked this conversation as resolved.
Show resolved Hide resolved
if cpu_share is not None:
return min(cpu_share, cpu_count)
return cpu_count
Expand Down