Torn reads of GC statistics from external process via get_gc_stats
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
If an external tool sampling GC statistics does not pause the target process (and we designed get_gc_stats not to pause), it can read torn data under certain circumstances.
There are two distinct problems:
-
Weakly ordered platforms: The stores of
ts_startandts_stopmay be reordered by the CPU/optimizer. We need to add memory barriers to mitigate this. -
Large memcpy window: We are copying a sufficiently large memory region via
memcpy. If two or more GC cycles occur during this copy, we can end up with inconsistent data spanning multiple GC states.
@maurycy has an idea to use a sequence counter for consistency checks — I think he should definitely give it a try.
cc @pablogsal
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-155828
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず get_gc_stats と ts_start および ts_stop を格納している箇所を追跡し、次に外部プロセスが GC データをどのように観測するかについて memcpy パスを確認してください。最初にリンクされた PR gh-155828 と関連するテストをすべて読んでください。弱いメモリ順序付けのプラットフォームで、外部サンプリングが GC サイクルをまたいで分断されたスナップショットを返さなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- performance
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100