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

SecurityException on LDUtil.isInternetConnected check using LD v3.0.0 #129

Closed
maxkohne opened this issue Jun 2, 2021 · 7 comments
Closed

Comments

@maxkohne
Copy link

maxkohne commented Jun 2, 2021

Describe the bug

We are receiving reports of crashes from our crash reporting services. This has been happening since we upgraded to v3.0.0 of LaunchDarkly. So far, we have only seen reports from Android 11 users and all happen to be on different models of Samsung Galaxy devices (Galaxy A50, Galaxy A51, Galaxy A52, Galaxy S10, and Galaxy Z Fold2 5G). All crashes happened in the background according to Crashlytics.

To reproduce
We cannot reproduce in-house but we are seeing Bugsnag and Crashlytic events for this crash. We do not own any Samsung Galaxy models either.

Expected behavior
Don't expect to crash in a background state.

Logs

Fatal Exception: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4200010 (has extras) } in com.launchdarkly.sdk.android.ConnectivityReceiver@1e98b08
       at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1676)
       at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(-.java:2)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8512)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by java.lang.SecurityException: Package android does not belong to 10627
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2385)
       at android.os.Parcel.createException(Parcel.java:2369)
       at android.os.Parcel.readException(Parcel.java:2352)
       at android.os.Parcel.readException(Parcel.java:2294)
       at android.net.IConnectivityManager$Stub$Proxy.getNetworkCapabilities(IConnectivityManager.java:3347)
       at android.net.ConnectivityManager.getNetworkCapabilities(ConnectivityManager.java:1549)
       at com.launchdarkly.sdk.android.LDUtil.isInternetConnected(LDUtil.java:43)
       at com.launchdarkly.sdk.android.ConnectivityReceiver.onReceive(ConnectivityReceiver.java:24)
       at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1666)
       at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(-.java:2)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8512)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

SDK version
v3.0.0

Language version, developer tools
Kotlin 1.4.30

OS/platform
Android 11

@maxkohne maxkohne changed the title Crashes on LDUtil.isInternetConnected check using LD v3.0.0 SecurityException on LDUtil.isInternetConnected check using LD v3.0.0 Jun 2, 2021
@maxkohne
Copy link
Author

maxkohne commented Jun 3, 2021

Looks like this is a Google issue:

https://issuetracker.google.com/issues/175055271

@gwhelanLD
Copy link
Contributor

Hi @maxkohne,

Thanks for bringing this to our attention. We'll look at whether we can avoid this issue altogether or if we have to resort to simply catching and ignoring this SecurityException. I've filed it internal so we can schedule time to address the issue.

Thanks,
@gwhelanLD

@barnhill
Copy link

It appears this was deprecated in API 28, could this be the culprit?
https://developer.android.com/reference/android/net/ConnectivityManager#CONNECTIVITY_ACTION

@ssaxena01
Copy link

This exception is causing a large volume of crashes for our users on SDK v3.0.0. When do you anticipate a fix for it ? @gwhelanLD

@nicbell
Copy link

nicbell commented Jul 13, 2021

We are seeing large volumes of this crash too with 3.0.1. Only happening on Android 11 in the background.

@adavis
Copy link

adavis commented Jul 16, 2021

Could you all try this same approach to address?

gwhelanLD added a commit that referenced this issue Jul 16, 2021
## [3.0.2] - 2021-07-16
### Fixed
- Catch `SecurityException` when thrown on call to `getNetworkCapabilities` used to detect current network availability. ([#129](#129))
- Explicitely flag `PendingIntent`s as `FLAG_IMMUTABLE` on Android SDK versions that support doing so. Explicitly specifying mutability is required when targeting Android S+. ([#133](#133))
@gwhelanLD
Copy link
Contributor

Closing this issue as it was fixed in the 3.0.2 release.

Thanks,
@gwhelanLD

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

No branches or pull requests

6 participants