-
-
Notifications
You must be signed in to change notification settings - Fork 57
fix: Breadcrumb issues in Apple native bridge #2327
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
Conversation
NSString
in native bridgeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we add some tests for this new functionality? Are there any?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing stopping me from approving this is tests. The PR changes the logic a bit. I'm pretty sure we could write some tests that reproduce the problem. What's stopping us from adding these?
We don't have any unit tests for the bridge but instead, cover this via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @bitsandfoxes
breadcrumb.timestamp = | ||
[dateFormatter dateFromString:[NSString stringWithUTF8String:timestamp]]; | ||
if (timestampString != nil && timestampString.length > 0) { | ||
breadcrumb.timestamp = [sentry_cachedISO8601Formatter() dateFromString:timestampString]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes indeed ⬆️
@bitsandfoxes did you address the comment of Cursor #2327 ![]() I don't see any commits after my review, or am I missing something? |
Ups sorry, I could have been clearer with my wording. I'm sorry about the hassle. |
Superseds #2321
The Problem
We've received different crash events originating from the SDK when running on Apple platforms.
Date Formatting
The first crash we have is
This hints at invalid date formatting with
NSDateFormatter.dateFromString
attempting to parse the timestamp using an invalid memory pointer, causingicu::Calendar::clear()
to dereferenceNULL (x0: 0x0)
.Breadcrumb Serialization Issue
and
Here
SentryWatchdogTerminationScopeObserver.addSerializedBreadcrumb
encounters an exception while serializing breadcrumb data.Proposal
A two-step approach:
Date Formatting
Instead of treating
NSCalendarIdentifierISO8601
as a string (which it is not see docs) and setting it insentry-unity/package-dev/Plugins/iOS/SentryNativeBridge.m
Line 74 in 7b225d0
Corrupted Breadcrumb Data
We preallocate and validate the strings passed into the bridge before handing it over to the Cocoa SDK.