Skip to content

Conversation

philprime
Copy link
Member

📜 Description

Ensures Session Replay resume and pauseSessionMode operations are dispatched to the main thread when network connectivity changes.

💡 Motivation and Context

The connectivityChanged callback, which signals network status, can be invoked on a background thread. Directly calling SentrySessionReplay's resume or pauseSessionMode from this background thread can lead to a race condition with the session tracker, which is initialized and managed on the main thread. This race condition has been observed to cause EXC_BAD_ACCESS crashes. By dispatching these operations to the main thread, we ensure thread safety and prevent these crashes.

💚 How did you test it?

No specific tests were added or run during the conversation. This is a logical fix based on thread safety principles.

📝 Checklist

You have to check all boxes before merging:

  • 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.

Slack Thread

Open in Cursor Open in Web

Copy link

cursor bot commented Sep 4, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Copy link
Contributor

github-actions bot commented Sep 4, 2025

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Dispatch session replay to main thread ([#6082](https://github.com/getsentry/sentry-cocoa/pull/6082))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against 99730da

@philprime philprime self-assigned this Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants