Session Replay: buffered segment can be sent with the wrong video after buffer rotation
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- Kotlin
- 星號
- 1.4k
- 分支
- 483
- 平均合併
- 2 天 54 分鐘
- 30 天內合併 PR
- 207
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
getsentry/sentry-java 的其他 Issue
-
Test the `sentry wizard` Android port可能已有人在做 @antonis 於 1 天前認領。 未關閉Platform: Java
getsentry/sentry-java#6797 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Narrow and clean up Android consumer keep rules可能已有人在做 @runningcode 於 3 天前認領。 未關閉Android Platform: Java
getsentry/sentry-java#6771 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Android Bug Platform: Java Waiting for: Product Owner
難度 4/5 3-5 天 新手友好度 45/100
getsentry/sentry-java#6758 · 4 則留言 ·
維護者通常 1 天內回覆
-
Android Bug Platform: Java Replays
難度 3/5 1-2 天 新手友好度 50/100
getsentry/sentry-java#6740 · 1 則留言 ·
維護者通常 1 天內回覆
-
Android Feature Platform: Java Waiting for: Product Owner
難度 3/5 1-2 天 新手友好度 45/100
getsentry/sentry-java#6731 · 1 則留言 ·
維護者通常 1 天內回覆
查看 getsentry/sentry-java 的全部 Issue
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 62/100
IacobIonut01/ReFra#1515 · 1 則留言 ·
維護者通常 4 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
openwatersio/slackwater-android#162 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 半天 新手友好度 72/100
developmentwithyash/yaan#184 ·
維護者通常 1 天內回覆
-
analytics
難度 2/5 1-3 小時 新手友好度 62/100
-
🐛 Type:Bug 📏 Size: S 🔧 State:In Progress 🔹 Priority: P2 - Medium
難度 2/5 1-3 小時 新手友好度 70/100
yeliqin666/xjtu-toolbox-android#623 · 1 則留言 ·