Associate thread-local data/context with a faulthandler traceback
まだ誰も着手していません。
評価
調査の方向性
faulthandlerモジュールから始め、リンクされているPython-ideasの議論を確認して、提案されているスレッドローカルコンテキストとその制約を理解してください。関数とコンテキストマネージャーの例を、要求されているtraceback出力と比較してください。完了とするには、コンテキストの関連付けと出力について、合意されたAPIと動作が必要です。
索引モデルが issue の本文から書いたものです。
説明
Feature or enhancement
I’d like to be able to associate a thread-local string with the faulthandler module.
Pitch
The faulthandler module is invaluable for tracking down segfaults in native code, however it is really lacking the ability to add some kind of useful breadcumb to aide debugging. Imagine you are running a large-scale distributed job over tens of millions of images and a single one causes opencv to segfault reliably. This can be very difficult to track down.
It would be very useful to be able to add a string (limited by size) via the faulthandler module that is outputted along with the traceback. For example:
for image in millions_of_images():
faulthandler.context(f'{image.id=}')
segfaulty_function(image)
# Or maybe:
for image in millions_of_images():
with faulthandler.context(f'{image.id=}'):
segfaulty_function(image)
The traceback might be something like:
Fatal Python error: Segmentation fault
Current thread 0x00007fb899f39700 (most recent call first):
.... (traceback)
Segmentation fault
Context: image_id=foo
You could of course add logging to this function to print out the image ID before you run it through segfaulty_function, but if you're running this at high volume on a huge number of machines, this becomes a bit of an overhead, and it doesn't handle multiple threads running the function well.
Previous discussion
This is lifted from the following thread on Python-ideas: https://mail.python.org/archives/list/python-ideas@python.org/message/BG36W24KEEX4YJA7CZ3PGW4ISZGVXMH6/
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 558
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/cpython のほかの issue
-
docs pending
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
build type-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
stdlib topic-email type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
🐛 Bug 🔔 Pending processing
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
jumpserver/jumpserver#17584 ·