python / python/cpython

multiprocessing async .get() hangs if the pool is terminated

オープン
#126,743 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

stdlib topic-multiprocessing type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

MWE

Steps to reproduce:

import multiprocessing
from time import sleep

with multiprocessing.Pool() as p:
    result = p.apply_async(sleep, (1,))
result.get()

Expected behavior:

Either:

  • result is returned. (Pool().__exit__ waits for every async task to finish); or
  • some kind of exception is raised when .get() is called outside with Pool()

Comments

This is the same as #79659. That was marked as completed in 2021. However it seems the issue is still present.

CPython versions tested on:

3.12, 3.13, 3.14

Operating systems tested on:

Linux

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、提供された MWE を実行し、pool の終了後における Pool.exit と非同期結果の .get() 呼び出しの相互作用を追跡します。issue #79659 と動作を比較し、ハングではなく完了または例外になるという、文書化された期待結果をカバレッジに追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
operating-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。