Crash on upgrade from 8.20.0 -> 8.25.0 via Span.finish
nebsta opened this issue · 7 comments
Platform
iOS
Environment
Develop
Installed
Swift Package Manager
Version
8.25.0
Did it work on previous versions?
8.20.0
Steps to Reproduce
- Install a version of the app that is using version 8.20.0 of the Sentry iOS SDK
- Update to a version of the app that is using version 8.25.0 of the Sentry iOS SDK
- Crash occurs on startup
Expected Result
We expect the crash not to occur
Actual Result
![330344319-4c996226-fbde-4d92-b44f-eaeee4a9839f](https://private-user-images.githubusercontent.com/94231771/330352119-f6ebd41f-c083-4974-b80d-5fd7c8dfbed1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg3NzkyNjAsIm5iZiI6MTcxODc3ODk2MCwicGF0aCI6Ii85NDIzMTc3MS8zMzAzNTIxMTktZjZlYmQ0MWYtYzA4My00OTc0LWI4MGQtNWZkN2M4ZGZiZWQxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE5VDA2MzYwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdhNTU3NTdiYjZlYzU1MWRjOWQ4MTM3MjZhODkxMGEwZDA2N2U3MWVmM2ViZmZjZTRjMDliMmFiOTBkOGI3NDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.VjECoGHvRjuQ--oe2HANtdUhuYDzh8b2N8YH_x4Q0lw)
Few other notes:
- The span being finished is one that captures the boot time for all our internal systems at startup
- After the crash, if you restart the app on the 8.25.0 version there won't be any crash after that
Are you willing to submit a PR?
No response
Hey @nebsta,
I tried to reproduce the issue, but couldn't. I see that you have your own wrapper around SenrySpan. Can you share more details on how to initialize your instance of SentrySpan so we can reproduce the issue? A small sample project that reproduces the issue would even be the best. Furthermore, it would be great if you could share the crash report with us.
It seems like the culprit is #3892, which moved capturing the transaction to a background thread.
Hey @nebsta,
I tried to reproduce the issue, but couldn't. I see that you have your own wrapper around SenrySpan. Can you share more details on how to initialize your instance of SentrySpan so we can reproduce the issue? A small sample project that reproduces the issue would even be the best. Furthermore, it would be great if you could share the crash report with us.
It seems like the culprit is #3892, which moved capturing the transaction to a background thread.
@philipphofmann sorry for the late reply. Didn't get a notification about you responding. Here is a snippet of what the wrapper looks like. We mainly have this so that we can swap out reporting libraries in the future if we want to. As you can see it's pretty simple, nothing too fancy.
// Copyright © 2023 Trustpilot. All rights reserved.
import Foundation
import Sentry
class SentrySpan: SentrySpanProtocol {
private let sentrySpan: Span
init(span: Span) {
self.sentrySpan = span
}
func startChild(operation: String) -> SentrySpanProtocol {
let sentrySpan = self.sentrySpan.startChild(operation: operation)
return SentrySpan(span: sentrySpan)
}
func finish(status: TrustpilotSpanStatus) {
sentrySpan.finish(status: status.toSentrySpanStatus())
}
func finish() {
sentrySpan.finish()
}
}
extension TrustpilotSpanStatus {
func toSentrySpanStatus() -> SentrySpanStatus {
switch self {
case .internalError: return .internalError
}
}
}
// Copyright © 2023 Trustpilot. All rights reserved.
import Foundation
protocol SentrySpanProtocol {
func startChild(operation: String) -> SentrySpanProtocol
func finish(status: TrustpilotSpanStatus)
func finish()
}
enum TrustpilotSpanStatus {
case internalError
}
I'll see if I can get a full crash report from the sentry dashboard and post it here soon.
Thanks for the update, @nebsta. The full crash report would be helpful. I think I see a couple of occurrences of this in our internal SDK crash detection.
@philipphofmann classically I can't seem to replicate the issue anymore, so I'm unable to get the crash log for you. But by the sounds of it, it seems like it's a known issue if you have seen occurrences of it.
Yes, I think we should have enough information to fix it. Thanks for the update.
@philipphofmann any update on a fix?
@nebsta, I'm sorry no, not yet. We didn't get to this yet.