Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR] Fix crashes and add replay lifecycle management #4135

Merged
merged 12 commits into from
Feb 5, 2025

Conversation

romtsn
Copy link
Member

@romtsn romtsn commented Feb 3, 2025

📜 Description

  • Fix FileNotFoundException by checking for file existence and creating it before writing
  • Introduce a new ReplayLifecycle class which tracks and manages the lifecycle of a running replay:
    • This should prevent misbehaviors when e.g. calling pause or resume multiple times
    • Also introduced some guards to not track touch events and to not resume a replay when it was paused for a different reason (e.g. if rate limit is lifted, but we still have no internet connection we should not resume).
    • Also added locks so the lifecycle methods are synchronized (this is in preparation for the upcoming public API)
  • Wrap addOnDrawListener into a try-catch block as checking it for being alive was still not enough apparently (still got some crashes reported on it)
  • Add motorola devices to the list of devices that should use software canvas for encoding videos. There's an internal bug report that points to a SIGABRT in RenderThread - we were able to fix it for xiaomi devices (that had a similar backtrace) the same way, so I'm just gambling here. If the fix does not work out, the issue probably lies in PixelCopy and we might need to exclude some devices from replay/capture screenshot in an old way.

💡 Motivation and Context

Closes getsentry/sentry-react-native#4498
Closes #4133
Closes getsentry/sentry#83352

💚 How did you test it?

Manually + automated

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

github-actions bot commented Feb 3, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 408.10 ms 445.08 ms 36.98 ms
Size 1.58 MiB 2.21 MiB 639.81 KiB

Previous results on branch: rz/fix/session-replay-crashes

Startup times

Revision Plain With Sentry Diff
0c1c6eb 432.08 ms 496.06 ms 63.98 ms

App size

Revision Plain With Sentry Diff
0c1c6eb 1.58 MiB 2.21 MiB 639.96 KiB

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, LGTM!

@romtsn romtsn merged commit 5202700 into main Feb 5, 2025
35 checks passed
@romtsn romtsn deleted the rz/fix/session-replay-crashes branch February 5, 2025 20:01
romtsn added a commit that referenced this pull request Feb 7, 2025
@simonwh
Copy link

simonwh commented Feb 17, 2025

@romtsn Was this included in the latest react-native release 6.7.0? It looks like it was added, but no new release triggered yet getsentry/sentry-react-native@80e955a

@romtsn
Copy link
Member Author

romtsn commented Feb 17, 2025

@simonwh nope, 6.7.0 had been cut before this fix landed, we'll release a new patch version this week!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants