기술 · 실용 가이드
Python “BrokenProcessPool”? 배치를 재시도하기 전에 죽은 worker를 찾으세요
부모 예외는 worker가 비정상 종료됐다는 뜻일 뿐입니다. PID와 task marker를 보존하고 spawn, native crash, OOM을 구분한 뒤 pool을 다시 만드세요.

BrokenProcessPool은 ProcessPoolExecutor worker 하나 이상이 clean exit하지 않았다는 뜻이다. 일반 task exception, OOM, segfault, import error 중 무엇인지는 증명하지 않는다. worker가 사라지면 여러 pending Future가 같은 pool-level exception을 받을 수 있다.
parent task ledger, worker PID marker, OS evidence를 연결한다. 하나의 cause branch와 suspect input을 격리하기 전에는 전체 batch를 다시 제출하지 않는다.
재시도 전 parent ledger 고정
submission마다 task ID, input key, time, Future, side-effect boundary를 기록한다. pool이 깨지면 bulk retry를 중지하고 stderr와 service log를 보존한다.
여러 Future의 BrokenProcessPool은 각 input이 worker를 죽였다는 뜻이 아니다.
worker start와 phase 표시
task entry에서 PID, task ID, input key, Python version, start method, phase를 flush한다. initializer는 작고 deterministic하게 두고 entry와 success를 기록한다.
marker가 없으면 real .py file, importable main, 필요한 main guard, top-level callable, serializable argument를 시험한다. fork로 무작정 바꾸지 않는다.
native crash와 signal evidence 보존
suspect native code 전에 faulthandler를 활성화해 durable stderr로 보낸다. crash report, service status, container reason, child exit code를 보존한다.
negative exit status는 signal일 수 있지만 pool failure 뒤 다른 worker도 terminate될 수 있다. 첫 dead PID와 timestamp를 연결한다.
OOM branch 증명 또는 배제
Linux cgroup v2에서는 실행 전후 memory.events 또는 memory.events.local을 비교한다. oom_kill delta는 kill 증거지만 high, max, oom은 같은 뜻이 아니다.
cgroup path, memory.current, 가능하면 memory.peak, worker count, input size, per-process copy를 기록한다. max_workers 감소만으로는 증명이 아니다.
worker 하나와 input 하나로 축소
같은 callable을 serial로 실행하고 다음에 real file에서 one-worker executor로 실행한다. task/PID marker를 유지하고 input을 이분 탐색한다.
one-worker는 성공하고 multi-worker가 실패하면 total memory, file descriptor, native thread pool, start method를 비교한다.
causal recovery test로 종료
task 하나, PID 하나, normal result 또는 ordinary Future exception, 변하지 않은 oom_kill, fatal crash 없음이 closure다. 작은 concurrency로 각 input이 한 번만 처리되는지 확인한다.
그 뒤 worker count, memory limit, start method, dependency, initializer, retry policy를 바꾸고 cause, version, evidence window, idempotency rule을 기록한다.
