Multiprocessing exitcode=None after join
未關閉
還沒有人認領這個 Issue。
stdlib
topic-multiprocessing
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
I sometimes observe exitcode=None after joining a process.
import multiprocessing as mp
import sys
import threading
sys.setswitchinterval(1e-6)
ctx = mp.get_context("fork")
failures = []
def lifecycle(n_iters=100, n_procs=4):
for _ in range(n_iters):
ps = [ctx.Process(target=int, daemon=True) for _ in range(n_procs)]
for p in ps:
p.start()
for p in ps:
p.join()
if p.exitcode is None:
failures.append(p.pid)
ts = [threading.Thread(target=lifecycle) for _ in range(2)]
for t in ts:
t.start()
for t in ts:
t.join()
print(f"{len(failures)}/{2*100*4} had exitcode=None after join()")
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
- gh-150360
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先執行提供的 Linux Python 3.13 reproducer,重點關注使用 fork context 的 multiprocessing 以及並行的生命週期呼叫。檢查連結的 PR gh-150360,並驗證 join 一個程序始終會得到非 None 的 exitcode,同時不會導致 threaded case 出現回歸。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- operating-systems
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100