-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
Crash on upgrade from 8.20.0 -> 8.25.0 via Span.finish #3977
Comments
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.
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. |
@philipphofmann are there any updates on this issue? We are currently blocked with upgrading to the latest sentry, as if we do, it will cause most (if not all) of our users to experience a crash on start up. |
Hi @nebsta, |
Hey @krystofwoldrich @philipphofmann - Just to update on this, this issue is currently blocking us from upgrading to Xcode 16 as 8.20.0 won't compile with Xcode 16 and upgrading to 8.36.0 (the latest version) still causes this crash. |
Hello @P-Foley-Trustpilot can you share the error Xcode 16 gives with version 8.20.0? |
Hi @brustolin, i've attached the errors list and where they occur |
Oh yes. We have fixes for those missing references. |
@nebsta, thanks for the update. Can you share a stacktrace of a crash on a simulator? |
I can't seem to export the detailed stack trace. The best I can do is the screenshot that I originally attached to the ticket |
@philipphofmann I had a thought the other day. Are the span operations thread safe? Because we're currently calling span.finish within an actor, so it's being executed in the threadpool and not on the main actor. Could that potentially be why we're seeing this problem? |
Hello @nebsta, span operations are thread safe, finishing it outside the main actor should not cause a problem. Do you have Sentry profiling enabled? If so, can you test without it? |
Yeah we do, I can turn it off and see if that resolves the issue |
@brustolin I tried setting the profiling sample rate to 0, and it doesn't seem to be happening anymore, though I also noticed before changing the same rate, that the exception was happening on my device via XCode even on a fresh install. Which is different to how we originally reported it, where it would only happen when we updated from an older version of sentry. |
@brustolin @philipphofmann I did notice one thing that may be related to this issue. Would like to get your thoughts on it. Basically we use the manually profiling transactions/spans for timing how long our bootstrapping process takes in the app. Our Bootstrapping system is broken up into steps, with each step being a single span within the overall bootstrap transaction. I just noticed that there is actually a bug whereby if one of the bootstrapping items fails, we actually never finish the running span, or the running transaction. This would also makes sense, as I have also seen our profiling sometimes showing ridiculously large bootstrapping times, which this is probably the reason for. The question is that if we don't finish a span/transaction, could there be issue here if we try to finish the same span/transaction when a previous one wasn't finished correctly? |
Yes, that could cause problems, but he SDK shouldn't crash. If you can confirm that this fixes the problem, it's easier for us to investigate the root cause. |
Finishing or refinishing a span should not matter; we have safeguards for these scenarios. If you could provide us with a reproduction of your flow and how you use transactions/spans, it would help us a lot in identifying whether we have a bug in the said safeguards. |
@brustolin I've outlined an explanation of how we're using them below, including some code examples as well. Hopefully that gives you a better picture. The main class where we use the spans and where this exception is happening is called the You can see a full gist of what the If you look within the
As I mentioned, there is a bug in this implementation, as if there is an exception in any of the bootstrap items, then we don't properly finish the span for the entire bootstrap process, which is something we're going to fix on our end. This is why I was wondering if perhaps this could be the reason for our crash, as I mentioned that we do sometimes see some instances in the 99th percentile that are reported to be going for as long as a couple of days, so I wonder if there is an issue in the mechanism for ensure that spans are always cleaned up. Hopefully that's enough to give you a better picture. |
I should also mention that the spans we're using the |
I looked at the diff in SentryTracer from 8.20.0 to 8.25.0 and couldn't find anything suspicious that could cause this crash. @nebsta, can you try to enable the Sentry Cocoa SDK debug logs with Also, can you try to update to the latest version 8.36.0, and check if the problem persists? I know you currently can't update to a higher version than 8.25.0, but if you could check that in debug and it works, we know the problem was fixed. There is a small chance that #4380 fixes the problem, but I doubt it because canceling the deadline timer for the manual transaction should be a NoOp as the deadline timer is nil. |
@philipphofmann We have been attempting to upgrade to 8.36.0 instead since it came out, but we're still getting the same issue. I'll try enabling the logs and see how that goes |
@philipphofmann I've attached the logs that appear when enabling debug leading up to the crash. One thing I also noticed actually looking at the code, which you'll also see in the logs, is that we actually start sentry on boot, then we stop it after the bootstrapper and then call start agains straight after. I can't remember exactly why we do this, but I wonder if this could also be causing issues. |
The last log message is
The logs don't show more log messages for installing all the integrations. Do you start your transaction leading to a crash directly after initializing the SDK a second time? I tried to reproduce your problem by starting the SDK, stopping it, starting it again and then directly capturing a transaction, but it works flawlessly.
Can you maybe try not stopping and starting the SDK and check if the crash still occurs? If it disappears, it would make it easier to identify the problem. |
The finish on the transaction that triggers the crash is before we stop and start the system.
I'll give this a go today and get back to you |
Platform
iOS
Environment
Develop
Installed
Swift Package Manager
Version
8.25.0
Did it work on previous versions?
8.20.0
Steps to Reproduce
Expected Result
We expect the crash not to occur
Actual Result
Few other notes:
Are you willing to submit a PR?
No response
The text was updated successfully, but these errors were encountered: