Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion benchmarks/utils/build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import argparse
import contextlib
import io
import multiprocessing
import os
import subprocess
import sys
Expand Down Expand Up @@ -528,7 +529,15 @@ def _chunks(seq: list[str], size: int):
)
in_progress: set[str] = set()

with ProcessPoolExecutor(max_workers=max_workers) as ex:
# Use 'spawn' instead of 'fork' to avoid deadlocks when the parent
# process has threads (e.g., from rich.logging.RichHandler).
# With 'fork', child processes inherit copies of locks that may be
# held by threads, causing deadlocks when those locks are needed.
# See: https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
mp_context = multiprocessing.get_context("spawn")
with ProcessPoolExecutor(
max_workers=max_workers, mp_context=mp_context
) as ex:
futures = {}
for base in batch:
in_progress.add(base)
Expand Down
Loading