SpanBatcher serializes spans while holding its buffer lock
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #8170 de @ansh-rohilla — cerrado sin fusionar
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 18/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- observability
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 2.2k
- Forks
- 713
- Merge medio
- 1 d 16 min
- PR fusionados (30 d)
- 113
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/sentry-python
-
Rate limits from later headers shorten longer active limitsPosiblemente ocupada @sentry-junior la tomó hace 12 días. AbiertoPython
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
getsentry/sentry-python#8296 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
perf: Source context re-reads the whole file via loader.get_source() for every framePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoImprovement Python Waiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
getsentry/sentry-python#8089 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Improvement Integration: Boto3 Python Traces
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
getsentry/sentry-python#8074 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
`litellm`: Set request parametersQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. AbiertoImprovement Python Spans
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
getsentry/sentry-python#7994 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
`cohere`: Set request parametersQuizá libre de nuevo @mohanprasath-dev la tomó hace 44 días y no hay ningún pull request abierto. AbiertoImprovement Python Spans Waiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
getsentry/sentry-python#7992 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de getsentry/sentry-python
Issues similares
-
request_access
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
-
blocker bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
achisolomon/software-factory#305 ·
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
erkamyaman/rust-anything#963 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
commonmark/commonmark-spec#850 ·
-
Documentation websiteAbiertodocumentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100