Skip to content

Replay flush followed by immediate stop deletes the buffered video #6247

Closed

Description

@buenaflor

Integration

sentry-android

Build System

Gradle

AGP Version

9.1.0

Proguard

Disabled

Other Error Monitoring Solution

No

Version

8.60.0

Steps to Reproduce

  1. Initialize SentryAndroid with both Replay sample rates set to 0.
  2. While the Activity is visible, run:
Sentry.replay().startBuffering()
Handler(Looper.getMainLooper()).postDelayed({
    Sentry.replay().flush()
    Sentry.replay().stop()
}, 5_000)

Reproduced on a Pixel 6a emulator running Android 13, using the default native recorder in a plain Android Activity without a Flutter engine or bridge. Also reproduced through Flutter.

Expected Result

Stop preserves the video from the requested flush so its queued envelope can be serialized.

Actual Result

Segment 0 uploads with zero video bytes. Adding a 10-second delay before stop uploads segment 0 with 15,039 video bytes in the native reproduction.

Flush creates 0.mp4, but immediate stop can attempt segment 0 again with no frames because the asynchronous callback advancing the converted session's segment ID is skipped after stop.

ReplayCache.createVideoOf() deletes the existing output before checking for empty frames, removing the flushed video before transport reads it. Native diagnostics during the Flutter reproduction confirmed deletion of the existing 4,394-byte file.

Suggested fix: Move output-file deletion below the empty-frame guard and add a regression test preserving an existing video. A temporary native guard made the Flutter reproduction pass with 4,394 video bytes. Segment-ID reuse also needs investigation; this guard addresses the confirmed empty-frame deletion.

Related: getsentry/sentry-dart#4071. This is a separate deletion path from the fix in #6177.

Activity

  1. linear-code commented on Oct 12, 2026

    @linear-code
  2. self-assigned this
    on Oct 12, 2026
  3. added 3 commits that reference this issue on Oct 21, 2026
    b7bace6
    00efd2d
    814ae44
  4. github-actions commented on Oct 22, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #6340, which was included in the 8.61.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions