-
-
Notifications
You must be signed in to change notification settings - Fork 349
Session Replay is not cleaned up correctly after calling Sentry.close #5069
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
Comments
It looks to me like the change from |
I believe the issue lies in the starting of session replay capturing of frames. The |
Further investigations now surfaced that the This comment states we do not want to automatically start a new session as soon as the SDK starts: sentry-cocoa/Sources/Sentry/SentrySessionTracker.m Lines 46 to 52 in da7b357
Therefore we instead rely on the sentry-cocoa/Sources/Sentry/SentrySessionTracker.m Lines 135 to 149 in da7b357
This method then calls sentry-cocoa/Sources/Sentry/SentrySessionTracker.m Lines 163 to 179 in da7b357
If sentry-cocoa/Sources/Sentry/SentryHub.m Line 131 in da7b357
Which will forward the calls to the session replay integration: sentry-cocoa/Sources/Sentry/SentrySessionReplayIntegration.m Lines 508 to 512 in da7b357
Therefore the first step must be fixing the session tracker to ensure that a "session" is actually starting. |
Description
I created a sample in #5055 which provides a function to reload the Sentry SDK:
When closing the SDK the on-demand replay capturing is not restarted.
An initial investigation showed that uninstalling the
SentrySessionReplayIntegration
calls the methodSentrySessionReplay.pause()
which invalidates theCADisplayLink
used as the trigger for creating frames:https://github.com/getsentry/sentry-cocoa/blob/0782001b8903e178a3bb8db34f2f366ce1cc04ab/Sources/Sentry/SentrySessionReplayIntegration.m#L523C9-L527
sentry-cocoa/Sources/Swift/Integrations/SessionReplay/SentrySessionReplay.swift
Lines 108 to 117 in 0782001
When installing the SDK again, there seems to be left-over state and the session replay recorder is not bootstrapped correctly.
When calling
stop()
instead ofpause()
in theSentrySessionReplayIntegration
, the object gets deallocated and discarded, but it is not started again correctly.The text was updated successfully, but these errors were encountered: