SpanBatcher serializes spans while holding its buffer lock
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #8170 di @ansh-rohilla — chiusa senza merge
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 18/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- observability
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 2.2k
- Fork
- 713
- Merge medio
- 1g 16m
- PR unite (30g)
- 113
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di getsentry/sentry-python
-
Rate limits from later headers shorten longer active limitsForse già presa @sentry-junior l’ha presa 12 giorni fa. ApertaPython
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsentry/sentry-python#8296 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
perf: Source context re-reads the whole file via loader.get_source() for every frameForse già presa Una pull request collegata a questa issue è aperta o già unita. ApertaImprovement Python Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
getsentry/sentry-python#8089 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Improvement Integration: Boto3 Python Traces
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
getsentry/sentry-python#8074 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
`litellm`: Set request parametersForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. ApertaImprovement Python Spans
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
getsentry/sentry-python#7994 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
`cohere`: Set request parametersForse di nuovo libera @mohanprasath-dev l’ha presa 44 giorni fa e non c’è nessuna pull request aperta. ApertaImprovement Python Spans Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
getsentry/sentry-python#7992 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di getsentry/sentry-python
Issue simili
-
request_access
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
blocker bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
achisolomon/software-factory#305 ·
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
erkamyaman/rust-anything#963 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
commonmark/commonmark-spec#850 ·
-
Documentation websiteApertadocumentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100