SpanBatcher serializes spans while holding its buffer lock
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #8170 @ansh-rohilla による — マージされずにクローズ
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 18/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
The lock problem lives in SpanBatcher._flush(), which holds _lock while calling _dynamic_sampling_context() and _to_transport_format(). Reproduce it by pausing _to_transport_format on a threading.Event and checking that _lock.acquire(blocking=False) fails from another thread. The author's branch and its three regression tests show the proposed shape, but the approach is still awaiting a maintainer decision, so do not start a patch before that. Done means serialization runs outside the lock and failed serialization restores spans ahead of newer ones.
索引モデルが issue の本文から書いたものです。
説明
Problem
SpanBatcher._flush() holds _lock while calling _dynamic_sampling_context() and serializing spans with _to_transport_format(). This blocks concurrent additions for the entire serialization step and leaves a possible re-entrant lock-order hazard. The related fix in #7776 explicitly excludes SpanBatcher.
Reproduction
Patch _to_transport_format to pause on a threading.Event, then try batcher._lock.acquire(blocking=False) from another thread. It fails while serialization is in progress on master.
Proposed fix
Detach selected per-trace buffers under the lock, serialize outside the lock, and restore detached spans ahead of newly arrived spans if serialization fails. Keep the existing per-trace envelope boundaries.
A small candidate patch and three regression tests are on this branch. Local focused tests against SDK 2.61.0: 3 failed on baseline, 3 passed with the patch. Full upstream CI has not been run.
Would this approach be acceptable? I'll hold the draft PR until a maintainer has weighed in, in line with CONTRIBUTING.md.
- 主要言語
- Python
- スター
- 2.2k
- フォーク
- 713
- 平均マージ
- 1日 16分
- マージ済み PR(30日)
- 113
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry-python のほかの issue
-
Rate limits from later headers shorten longer active limits対応中かも @sentry-junior が 12 日前に担当しました。 オープンPython
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsentry/sentry-python#8296 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
perf: Source context re-reads the whole file via loader.get_source() for every frame対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンImprovement Python Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
getsentry/sentry-python#8089 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Improvement Integration: Boto3 Python Traces
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
getsentry/sentry-python#8074 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`litellm`: Set request parameters再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンImprovement Python Spans
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
getsentry/sentry-python#7994 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`cohere`: Set request parameters再び着手できるかも @mohanprasath-dev が 44 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンImprovement Python Spans Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
getsentry/sentry-python#7992 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
getsentry/sentry-python の issue をすべて見る
似ている issue
-
request_access
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
-
blocker bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
achisolomon/software-factory#305 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
erkamyaman/rust-anything#963 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
commonmark/commonmark-spec#850 ·
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100