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

fix: Crash in Span when Tracer nil #1416

Merged
merged 2 commits into from
Oct 21, 2021
Merged

Conversation

philipphofmann
Copy link
Member

@philipphofmann philipphofmann commented Oct 21, 2021

📜 Description

The SentrySpan has a weak reference to SentryTracer to avoid a strong
reference cycle. Therefore, ARC can deallocate the SentryTracer if no one
keeps a strong reference to the SentryTracer. When calling startChild on
SentrySpan and the SentryTracer is nil, the code currently crashes. This
is fixed now by adding a SentryNoOpSpan.

💡 Motivation and Context

Fixes GH-1367

💚 How did you test it?

Unit tests.

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • Review from the native team if needed
  • No breaking changes

🔮 Next steps

While this fixes GH-1367, we still need to investigate why the SentryTracer is nil. With this fix the app doesn't crash anymore, but we lose the corresponding span.

The SentrySpan has a weak reference to SentryTracer to avoid a strong
reference cycle. Therefore, ARC can deallocate the SentryTracer if no one
keeps a strong reference to the SentryTracer. When calling startChild on
SentrySpan and the SentryTracer is nil, the code currently crashes. This
is fixed now by adding a SentryNoOpSpan.

Fixes GH-1367
Copy link
Contributor

@brustolin brustolin left a comment

Choose a reason for hiding this comment

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

Looks good!

@philipphofmann philipphofmann requested a review from a team October 21, 2021 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SentryPerformanceTracker: key cannot be nil
3 participants