Closed grebulon closed 3 years ago
Facing the same issue after releasing the latest SDK. ANRs are increased by more than 30% due to this deadlock. Had to revert back to old sdk.
Happening specifically in Huawai Devices
private static AttributionIdentifiers getAndroidIdViaService(Context context) {
GoogleAdServiceConnection connection = new GoogleAdServiceConnection();
Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
intent.setPackage("com.google.android.gms");
if (context.bindService(intent, connection, Context.BIND_AUTO_CREATE)) {
try {
GoogleAdInfo adInfo = new GoogleAdInfo(connection.getBinder()); // THIS IS BLOCKING
AttributionIdentifiers identifiers = new AttributionIdentifiers();
identifiers.androidAdvertiserId = adInfo.getAdvertiserId();
identifiers.limitTracking = adInfo.isTrackingLimited();
return identifiers;
} catch (Exception exception) {
Utility.logd("android_id", exception);
} finally {
context.unbindService(connection);
}
}
return null;
}
That getBinder()
method on the GoogleAdServiceConnection
inner class uses a blocking queue queue.take()
.
It seems that queue contains references to IBinder
services which get added onServiceConnected
, my guess is that there's nothing on that queue by the time getAndroidIdViaService
is called and it just lingers there, while at the same time a service is connecting and it cannot add elements to the queue because it's blocked trying to read.
The solution is probably in the time in which Facebook's SDK calls getAndroidIdViaService
it might be doing so prematurely.
i also have this problem,please fix it
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
No activity doesn't mean that the problem is solved...
Please fix the ANRs issue.
at android.os.BinderProxy.transactNative (Native method) at android.os.BinderProxy.transact (Binder.java:778) at android.app.IActivityManager$Stub$Proxy.bindService (IActivityManager.java:4979) at android.app.ContextImpl.bindServiceCommon (ContextImpl.java:1622) at android.app.ContextImpl.bindService (ContextImpl.java:1561) at android.content.ContextWrapper.bindService (ContextWrapper.java:684) at com.facebook.internal.AttributionIdentifiers.getAndroidIdViaService (AttributionIdentifiers.java:163) at com.facebook.internal.AttributionIdentifiers.getAndroidId (AttributionIdentifiers.java:81) at com.facebook.internal.AttributionIdentifiers.getAttributionIdentifiers (AttributionIdentifiers.java:180) at com.facebook.FacebookSdk.publishInstallAndWaitForResponse (FacebookSdk.java:660) at com.facebook.FacebookSdk$5.run (FacebookSdk.java:648) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636) at java.lang.Thread.run (Thread.java:780)
The same problem !!!
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
i also have this problem,please fix it
Checklist
Environment
1.8.0_222
29
Gradle
version4.0.0
Goals
Just running my app
Expected Results
No ANRs
Actual Results
We get occasional ANR which I traced to the described deadlock
Steps to Reproduce
Just use Facebook SDK with enough users and you'll get to this deadlock
Code Samples & Details
Here are the stack traces that describe the deadlock. These are the only two threads in the process that run Facebook code. You'll notice that AsyncTask #4 is waiting, probably for main thread which is holding mutator lock mutex.