SpanBatcher serializes spans while holding its buffer lock
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
- #8170 von @ansh-rohilla — ohne Merge geschlossen
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 18/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- observability
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 2.2k
- Forks
- 713
- Ø Merge
- 1 T. 16 Min.
- Gemergte PRs (30 T.)
- 113
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus getsentry/sentry-python
-
Rate limits from later headers shorten longer active limitsEvtl. vergeben @sentry-junior hat das vor 12 Tagen übernommen. OffenPython
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
getsentry/sentry-python#8296 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
perf: Source context re-reads the whole file via loader.get_source() for every frameEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. OffenImprovement Python Waiting for: Product Owner
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
getsentry/sentry-python#8089 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Improvement Integration: Boto3 Python Traces
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
getsentry/sentry-python#8074 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
`litellm`: Set request parametersEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. OffenImprovement Python Spans
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
getsentry/sentry-python#7994 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
`cohere`: Set request parametersEvtl. wieder frei @mohanprasath-dev hat das vor 44 Tagen übernommen, und es ist kein Pull Request offen. OffenImprovement Python Spans Waiting for: Product Owner
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
getsentry/sentry-python#7992 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in getsentry/sentry-python
Ähnliche Issues
-
request_access
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 75/100
-
blocker bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
achisolomon/software-factory#305 ·
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 92/100
erkamyaman/rust-anything#963 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
commonmark/commonmark-spec#850 ·
-
Documentation websiteOffendocumentation good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100