SpanBatcher serializes spans while holding its buffer lock
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
- #8170 par @ansh-rohilla — fermée sans fusion
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 18/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- python
- Domaine
- observability
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 2.2k
- Forks
- 713
- Merge moyen
- 1 j 16 min
- PR mergées (30 j)
- 113
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de getsentry/sentry-python
-
Rate limits from later headers shorten longer active limitsPeut-être pris @sentry-junior l’a pris il y a 12 jours. OuvertePython
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
getsentry/sentry-python#8296 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
perf: Source context re-reads the whole file via loader.get_source() for every framePeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. OuverteImprovement Python Waiting for: Product Owner
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
getsentry/sentry-python#8089 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Improvement Integration: Boto3 Python Traces
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
getsentry/sentry-python#8074 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
`litellm`: Set request parametersPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. OuverteImprovement Python Spans
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
getsentry/sentry-python#7994 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
`cohere`: Set request parametersPeut-être à nouveau libre @mohanprasath-dev l’a pris il y a 44 jours, et aucune pull request n’est ouverte. OuverteImprovement Python Spans Waiting for: Product Owner
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
getsentry/sentry-python#7992 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de getsentry/sentry-python
Issues similaires
-
request_access
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
-
blocker bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
achisolomon/software-factory#305 ·
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 92/100
erkamyaman/rust-anything#963 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
commonmark/commonmark-spec#850 ·
-
Documentation websiteOuvertedocumentation good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100