Skip to content

AST extraction crashes on machines with >61 logical cores (Windows ProcessPoolExecutor cap) #1298

Closed

Description

@DSmereski

On a 64-core Windows 11 machine, graphify extract (and the /graphify skill, which calls graphify.extract.extract() directly) crashes during AST extraction:

File ".../graphify/extract.py", line 11569, in _extract_parallel
    with concurrent.futures.ProcessPoolExecutor(max_workers=max_workers) as pool:
File ".../concurrent/futures/process.py", line 682, in __init__
    raise ValueError(...)
ValueError: max_workers must be <= 61

Cause

_extract_parallel defaults max_workers to cpu_count (extract.py:11561 → min(cpu_cap, len(uncached_work))). On Windows, ProcessPoolExecutor hard-caps at 61 workers (CPython limitation tied to WaitForMultipleObjects). Any machine with >61 logical cores hits the ValueError immediately.

Repro

  • OS: Windows 11 Enterprise (26200), 64 logical cores
  • Python: 3.12.8, graphifyy 0.8.38
  • Run graphify extract . (or /graphify . via the Claude Code skill) on any code corpus.

Workarounds (confirmed)

  1. graphify extract <path> --max-workers 16 — works.
  2. graphify update <path> — works (auto-capped to 29 workers in my run; only extract/full-pipeline defaults to cpu_count).
  3. Calling extract(files, max_workers=16) directly — works.

Suggested fix

Clamp the default in _extract_parallel:

cpu_cap = os.cpu_count() or 1
if sys.platform == "win32":
    cpu_cap = min(cpu_cap, 60)  # ProcessPoolExecutor hard cap is 61
max_workers = min(cpu_cap, len(uncached_work))

The skill (SKILL.md Step 3 Part A) calls extract() with no max_workers, so the crash is not avoidable from the skill side without this default fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions