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

Flake8 hangs on a windows machine with > 61 procs when running on > 1 file #1965

Closed
pylbert opened this issue Feb 13, 2025 · 2 comments
Closed

Comments

@pylbert
Copy link

pylbert commented Feb 13, 2025

how did you install flake8?

D:\temp>uv venv flake8
Using CPython 3.10.15
Creating virtual environment at: flake8
Activate with: flake8\Scripts\activate

D:\temp>flake8\Scripts\activate

(flake8) D:\temp>uv pip install flake8
Using Python 3.10.15 environment at: flake8
Resolved 4 packages in 85ms
Prepared 4 packages in 110ms
░░░░░░░░░░░░░░░░░░░░ [0/4] Installing wheels...
Installed 4 packages in 115ms
 + flake8==7.1.1
 + mccabe==0.7.0
 + pycodestyle==2.12.1
 + pyflakes==3.2.0

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.10.15",
    "system": "Windows"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.12.1"
    },
    {
      "plugin": "pyflakes",
      "version": "3.2.0"
    }
  ],
  "version": "7.1.1"
}

describe the problem

what I expected to happen

Flake8 should run and exit with defaults from the command line

Runs/does not exit (hangs after printing stack trace):

(flake8) D:\temp>flake8 testit0.py testit1.py
Exception in thread Thread-1 (_handle_workers):
Traceback (most recent call last):
  File "lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "lib\multiprocessing\pool.py", line 522, in _handle_workers
    cls._wait_for_updates(current_sentinels, change_notifier)
  File "lib\multiprocessing\pool.py", line 502, in _wait_for_updates
    wait(sentinels, timeout=timeout)
  File "lib\multiprocessing\connection.py", line 879, in wait
    ready_handles = _exhaustive_wait(waithandle_to_obj.keys(), timeout)
  File "lib\multiprocessing\connection.py", line 811, in _exhaustive_wait
    res = _winapi.WaitForMultipleObjects(L, False, timeout)
ValueError: need at most 63 handles, got a sequence of length 194   # <-- hangs here

Runs/exits (does NOT hang) when constrained to 61 jobs:

(flake8) D:\temp>flake8 testit0.py testit1.py --jobs 61

See possible fix #1964

@asottile
Copy link
Member

this issue claims that this is fixed -- what version of windows are you running on? python/cpython#71090 python/cpython#84444

@pylbert
Copy link
Author

pylbert commented Feb 18, 2025

Ah, ok - the cpython would be much preferred to a work around here. I can close my issue and pr.

I'm seeing this on:

Python 3.10.15 with flake8 7.1.0 on Windows Server 2022 Standard 21H2

(note: #1964 originally mentioned Windows 11, this should have been Windows Server 2022 - I've updated the PR text)

@pylbert pylbert closed this as completed Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants