SpanBatcher serializes spans while holding its buffer lock
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
- #8170 de @ansh-rohilla — fechado sem integrar
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 18/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- python
- Domínio
- observability
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 2.2k
- Forks
- 713
- Merge médio
- 1d 16min
- PRs com merge (30d)
- 113
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de getsentry/sentry-python
-
Rate limits from later headers shorten longer active limitsTalvez já em andamento @sentry-junior assumiu há 12 dias. AbertaPython
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
getsentry/sentry-python#8296 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
perf: Source context re-reads the whole file via loader.get_source() for every frameTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. AbertaImprovement Python Waiting for: Product Owner
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
getsentry/sentry-python#8089 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Improvement Integration: Boto3 Python Traces
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
getsentry/sentry-python#8074 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
`litellm`: Set request parametersTalvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. AbertaImprovement Python Spans
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
getsentry/sentry-python#7994 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
`cohere`: Set request parametersTalvez livre de novo @mohanprasath-dev assumiu há 44 dias e não há nenhum pull request aberto. AbertaImprovement Python Spans Waiting for: Product Owner
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
getsentry/sentry-python#7992 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de getsentry/sentry-python
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
521xueweihan/HelloGitHub#4599 ·
-
Bug Needs Triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
pandas-dev/pandas#72413 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
compiler-explorer/compiler-explorer#9710 ·
Mantenedores costumam responder em até 1 dia
-
bug harness
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
mruangutai/harness#2687 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
modal-labs/modal-client#4158 ·