SpanBatcher serializes spans while holding its buffer lock
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #8170 của @ansh-rohilla — đã đóng, không merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- observability
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 2.2k
- Fork
- 713
- Merge trung bình
- 1 ngày 16 phút
- Pull request đã merge (30 ngày)
- 113
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/sentry-python
-
Rate limits from later headers shorten longer active limitsCó thể đã có người làm @sentry-junior đã nhận 12 ngày trước. Đang mởPython
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsentry/sentry-python#8296 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
perf: Source context re-reads the whole file via loader.get_source() for every frameCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởImprovement Python Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
getsentry/sentry-python#8089 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Improvement Integration: Boto3 Python Traces
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
getsentry/sentry-python#8074 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`litellm`: Set request parametersCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởImprovement Python Spans
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
getsentry/sentry-python#7994 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`cohere`: Set request parametersCó thể làm lại được @mohanprasath-dev đã nhận 44 ngày trước và không có pull request nào đang mở. Đang mởImprovement Python Spans Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
getsentry/sentry-python#7992 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của getsentry/sentry-python
Issue tương tự
-
request_access
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
-
blocker bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
achisolomon/software-factory#305 ·
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
erkamyaman/rust-anything#963 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
commonmark/commonmark-spec#850 ·
-
Documentation websiteĐang mởdocumentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100