Skip to content

expose logCrash function that can be called before SDK init #188

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

snowp
Copy link
Contributor

@snowp snowp commented Jan 17, 2025

This PR introduces a way to report a crash event even before the SDK has started. No real event information is currently included in the event, but this should be sufficient to trigger an upload should another crash framework notify us that there has been a crash.

By being able to be called before SDK init, this eliminates the ordering requirement between the initializing bitdrift before whatever crash handling may want to report a crash.

Since this is limited to a simple crash notification, we can take a lot of shortcuts, making this not suitable for general logging prior to init.

For both iOS and Android this uses a state machine guarded by synchronized access to make sure that we don't race against the SDK init. On Android this means that we are introducing a synchronized block during regular logger access where we previously could get away with atomics, though this just ends up matching the existing behavior on iOS.

Fixes BIT-4335

@snowp snowp force-pushed the deferred-crash-event branch from 27feb59 to b81e720 Compare January 17, 2025 21:10
@snowp snowp force-pushed the deferred-crash-event branch from b81e720 to 63f0db6 Compare January 17, 2025 21:10
@snowp snowp marked this pull request as ready for review January 24, 2025 16:19
@snowp snowp requested a review from murki January 24, 2025 16:19
@murki murki removed their request for review February 5, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant