python / python/cpython

Inconsistent behaviour of multiprocessing.shared_memory

オープン
#116,849 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

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

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

説明

Bug report

Bug description:

An example code already exists in the documentation (see from here: The following example demonstrates a practical use of the SharedMemory class with NumPy arrays, accessing the same numpy.ndarray from two distinct Python shells).

The code executes fine as expected and mentioned there until one closes the terminals which report warnings.

When the second terminal is closed: /home/souradeep/miniconda/envs/py39/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked shared_memory objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d '

and when the first terminal is closed: /home/souradeep/miniconda/envs/py39/lib/python3.9/multiprocessing/resource_tracker.py:229: UserWarning: resource_tracker: '/trial': [Errno 2] No such file or directory: '/trial'

This can have implications when one tries to use the feature somewhere in an application (see an example).

CPython versions tested on:

3.9

Operating systems tested on:

Linux

Linked PRs
  • gh-119126

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

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

はじめの一歩

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

調査の方向性

multiprocessing のドキュメントにある共有メモリの例から始め、multiprocessing/resource_tracker.py を調査します。報告で再現されているシャットダウン時の警告に注目してください。リンクされている PR gh-119126 と、そのテストがあれば確認します。ドキュメント化された例がシャットダウン時に報告された resource-tracker の警告を生成しなくなれば、issue は完了です。

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

評価

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

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

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