Session Replay: buffered segment can be sent with the wrong video after buffer rotation
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 62/100
Piste de recherche
Start in sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt at the bufferedSegments.rotate call and read how remaining segments are re-assigned IDs while videoFile stays fixed. Then read ReplayCache.kt (getReplayOrDefaultFile/createVideoOf around line 140-151) to see where the $segmentId.mp4 name is built and deleted, plus ReplayCache.fromDisk and deleteExceptSegmentVideos for the recovery path. Write the failing test first: two buffered segments, expire the first, trigger an error, and assert the buffered segment keeps its own video; done means that test passes and disk recovery still finds all videos.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Problem
In buffer mode, an error can send a buffered segment with the wrong video.
Each video is stored at "$segmentId.mp4". When bufferedSegments.rotate removes an expired segment, it gives the remaining segments new IDs, but their videoFile does not change. Then currentSegment can be equal to the ID in the file name of a segment that is still buffered.
When an error occurs, the capture_replay task first encodes the current segment to "$currentSegment.mp4". createVideoOf deletes the file that is already there. After that, bufferedSegments.capture() sends the buffered segment, which now points to the new video.
Example
- Buffer mode. The user puts the app in the background.
pausebuffers segment 0 at0.mp4. - The user opens the app again and rotates the device.
configuration_changedbuffers segment 1 at1.mp4.currentSegmentis 2. - 30s after step 1, segment 0 expires. The rotation deletes
0.mp4. Segment 1 gets ID 0 but keeps1.mp4.currentSegmentis 1. - An error occurs before segment 1 expires. The current segment is encoded to
1.mp4, and the old content of that file is deleted. - The replay sends segment 0 and segment 1 with the same video. The video of the buffered segment is lost.
Proposed fix
Give each video a file name that does not depend on the segment ID that is sent, for example a counter that only increases, or a UUID. Make sure that crash recovery (ReplayCache.fromDisk and deleteExceptSegmentVideos) still finds the videos.
First, add a test on main that fails: two buffered segments, the first one expires, then an error occurs. The buffered segment must keep its own video.
Found while reviewing #6542. The bug is on main without that PR.
- Langage dominant
- Kotlin
- Étoiles
- 1.4k
- Forks
- 483
- Merge moyen
- 2 j 54 min
- PR mergées (30 j)
- 207
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-java
-
Test the `sentry wizard` Android portPeut-être pris @antonis l’a pris il y a 1 jour. OuvertePlatform: Java
getsentry/sentry-java#6797 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Narrow and clean up Android consumer keep rulesPeut-être pris @runningcode l’a pris il y a 3 jours. OuverteAndroid Platform: Java
getsentry/sentry-java#6771 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Android Bug Platform: Java Waiting for: Product Owner
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
getsentry/sentry-java#6758 · 4 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Android Bug Platform: Java Replays
Difficulté 3/5 1-2 jours Accessibilité débutants 50/100
getsentry/sentry-java#6740 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Android Feature Platform: Java Waiting for: Product Owner
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
getsentry/sentry-java#6731 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de getsentry/sentry-java
Issues similaires
-
[BUG] Issue reported from ReFraOuverteenhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
IacobIonut01/ReFra#1515 · 1 commentaire ·
Les mainteneurs répondent en général sous 4 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
openwatersio/slackwater-android#162 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 Une demi-journée Accessibilité débutants 72/100
developmentwithyash/yaan#184 ·
Les mainteneurs répondent en général sous 1 jour
-
analytics
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
-
🐛 Type:Bug 📏 Size: S 🔧 State:In Progress 🔹 Priority: P2 - Medium
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
yeliqin666/xjtu-toolbox-android#623 · 1 commentaire ·