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 rare crash when loading device ID #1137

Merged
merged 1 commit into from
Feb 15, 2021
Merged

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Feb 15, 2021

Goal

The DeviceIdStore can throw an AssertionError from JsonReader#peek() if the JSON parser state is inconsistent. Because DeviceIdStore only catches Exception, this can result in a crash when initializing Bugsnag.

Changeset

Catching Throwable rather than Exception fixes the problem.

Looking at the implementation of JsonReader, it appears that the error can get thrown when JSONReader's stack is in an inconsistent state. It's currently unknown what triggers this state.

The implementation can't currently recover from this scenario but should be able to do so with this fix. This fix allows the notifier to attempt to persist a new device ID each initialization if one was not present, and in the worst case returns an empty string for device ID.

@mattdyoung mattdyoung mentioned this pull request Feb 15, 2021
2 tasks
@tomlongridge tomlongridge linked an issue Feb 15, 2021 that may be closed by this pull request
2 tasks
@bugsnagbot
Copy link
Collaborator

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1474.28 1385.12
arm64_v8a 381.61 291.5
armeabi 361.12 271.01
armeabi_v7a 344.75 254.64
x86 422.55 332.44
x86_64 406.17 311.97

Generated by 🚫 Danger

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.

Crash in MyApplication.onCreate
3 participants