-
-
Notifications
You must be signed in to change notification settings - Fork 452
Crash the SDK on startup if mixed versions have been detected #4277
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
|
Need to create the linked docs page and explain common causes and how to fix this. |
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
🚨 Detected changes in high risk code 🚨High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:
|
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
aba15a8 | 405.40 ms | 427.65 ms | 22.25 ms |
a3e6b58 | 412.50 ms | 417.29 ms | 4.79 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
aba15a8 | 1.58 MiB | 2.22 MiB | 654.92 KiB |
a3e6b58 | 1.58 MiB | 2.22 MiB | 654.87 KiB |
…-versions-android
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!
Platform.isAndroid() | ||
? "https://docs.sentry.io/platforms/android/troubleshooting/mixed-versions" | ||
: "https://docs.sentry.io/platforms/java/troubleshooting/mixed-versions"; | ||
throw new IllegalStateException( |
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.
I hope people won't put a try-catch around this 😄
Co-authored-by: Roman Zavarnitsyn <[email protected]>
📜 Description
We check the versions of loaded Sentry dependencies. If there is a mismatch between them we now throw an exception on
Sentry.init
/SentryAndroid.init
. If we do not throw early the application may crash soon thereafter or at some random point depending on features used and versions mixed. We opt for the controlled exception here vs. having crashes that are hard to understand later.NOTE:
This detection at startup will only work for new releases, so mixing
8.6.0
(assuming this PR lands there) and8.1.0
will not be detected at startup as theMANIFEST.MF
files with version are only present in new releases. For Android registering the packages and their version instatic
blocks is also new.💡 Motivation and Context
Fixes #4132
💚 How did you test it?
📝 Checklist
sendDefaultPII
is enabled.🔮 Next steps
Here's a sample exception when starting up Spring Boot 3:
Here's a sample crash for Android:
To test this you may need to change the version in
gradle.properties
to a SNAPSHOT use./gradlew publishToMavenLocal -x test
, then revertgradle.properties
and use both the version with and without SNAPSHOT to cause the mixed version detection to kick in.