Skip to content

Replay: canvas snapshots cause WebGL/canvas context loss and blinking #20178

@sentry-junior

Description

@sentry-junior

Summary

When replayCanvasIntegration is active, canvas-based web applications experience persistent blinking and visual corruption during a session replay recording. The issue manifests as repeated WebGL/canvas context loss caused by the replay SDK's canvas snapshot mechanism. Running window.Sentry.getReplay().stop() in the console immediately resolves the blinking, strongly implicating canvas snapshots as the root cause.

Reproduction

  1. Initialize Sentry Session Replay with replayCanvasIntegration enabled in a canvas-heavy web app (e.g. one using WebGL or 2D canvas extensively).
  2. Start a replay session.
  3. Observe intermittent blinking, visual corruption, or context loss in canvas elements while the replay SDK is active.
  4. Run window.Sentry.getReplay().stop() in the browser console.
  5. Observe blinking stops immediately.

Expected behavior

Canvas snapshot collection by the replay SDK should not cause WebGL or 2D canvas context loss or visible rendering artifacts in the host application.

Root cause hypothesis

The replay SDK's canvas snapshot mechanism (likely drawImage or getImageData calls against WebGL contexts, or forced context reads on 2D canvases) is triggering context loss or forcing canvas redraws on every snapshot interval. This degrades rendering performance and causes visible blinking.

Confidence: high — the direct getReplay().stop() → blinking-stops correlation is strong evidence.

Workaround

window.Sentry.getReplay().stop()

This stops canvas snapshots and immediately eliminates the blinking. Not suitable as a permanent fix as it disables replay entirely.

Related issues

Versions affected

Unknown — needs investigation. Issue observed with replayCanvasIntegration active.


Action taken on behalf of Prithvi Rajakumar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions