3

After updating the Facebook SDK version from 4.40.0 to 5.4.0, my app is getting a ton of ANRs. 12k ANRs in one day, the users couldn't even open the app.

Full Stack trace:

"main" prio=5 tid=1 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x7496b268 self=0xb2c84400
  | sysTid=8451 nice=0 cgrp=default sched=0/0 handle=0xb5b72534
  | state=S schedstat=( 0 0 0 ) utm=12 stm=7 core=2 HZ=100
  | stack=0xbe6c2000-0xbe6c4000 stackSize=8MB
  | held mutexes=
  at java.lang.Object.wait (Native method)
- waiting on <0x047bbe7f> (a java.lang.Object)
  at java.lang.Thread.parkFor$ (Thread.java:2127)
- locked <0x047bbe7f> (a java.lang.Object)
  at sun.misc.Unsafe.park (Unsafe.java:325)
  at java.util.concurrent.locks.LockSupport.park (LockSupport.java:161)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt (AbstractQueuedSynchronizer.java:840)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly (AbstractQueuedSynchronizer.java:994)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly (AbstractQueuedSynchronizer.java:1303)
  at java.util.concurrent.CountDownLatch.await (CountDownLatch.java:203)
  at com.facebook.internal.LockOnGetVariable.waitOnInit (LockOnGetVariable.java:64)
  at com.facebook.internal.LockOnGetVariable.getValue (LockOnGetVariable.java:54)
  at com.facebook.FacebookSdk.getCacheDir (FacebookSdk.java:954)
  at com.facebook.internal.instrument.InstrumentUtility.getInstrumentReportDir (InstrumentUtility.java:242)
  at com.facebook.internal.instrument.InstrumentUtility.listCrashReportFiles (InstrumentUtility.java:124)
  at com.facebook.internal.instrument.crashreport.CrashHandler.sendCrashReports (CrashHandler.java:101)
  at com.facebook.internal.instrument.crashreport.CrashHandler.enable (CrashHandler.java:73)
- locked <0x01f4fe4c> (a java.lang.Class<com.facebook.internal.instrument.crashreport.CrashHandler>)
  at com.facebook.internal.instrument.InstrumentManager.start (InstrumentManager.java:46)
  at com.facebook.FacebookSdk.sdkInitialize (FacebookSdk.java:326)
- locked <0x05939e95> (a java.lang.Class<com.facebook.FacebookSdk>)
  at com.facebook.marketing.internal.MarketingInitProvider.onCreate (MarketingInitProvider.java:42)
  at android.content.ContentProvider.attachInfo (ContentProvider.java:1753)
  at android.content.ContentProvider.attachInfo (ContentProvider.java:1728)
  at android.app.ActivityThread.installProvider (ActivityThread.java:6066)
  at android.app.ActivityThread.installContentProviders (ActivityThread.java:5658)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:5597)
  at android.app.ActivityThread.-wrap2 (ActivityThread.java)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1614)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6351)
  at java.lang.reflect.Method.invoke! (Native method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:896)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:786)
"GoogleApiHandler" tid=22 Native 
"GoogleApiHandler" prio=5 tid=22 Native
  | group="main" sCount=1 dsCount=0 obj=0x22c0caf0 self=0xab5c6700
  | sysTid=8512 nice=9 cgrp=default sched=0/0 handle=0x95332920
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=1 HZ=100
  | stack=0x95230000-0x95232000 stackSize=1038KB
  | held mutexes=
  #00  pc 0000000000048e38  /system/lib/libc.so (__epoll_pwait+20)
  #01  pc 000000000001a291  /system/lib/libc.so (epoll_pwait+60)
  #02  pc 000000000001a2c1  /system/lib/libc.so (epoll_wait+12)
  #03  pc 0000000000011e77  /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+118)
  #04  pc 0000000000011d73  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+26)
  #05  pc 0000000000096fbd  /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
  #06  pc 000000000067f0a5  /system/framework/arm/boot-framework.oat (Java_android_os_MessageQueue_nativePollOnce__JI+96)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:323)
  at android.os.Looper.loop (Looper.java:136)
  at android.os.HandlerThread.run (HandlerThread.java:61)
"TokenRefresher" tid=23 Native 
"TokenRefresher" prio=5 tid=23 Native
  | group="main" sCount=1 dsCount=0 obj=0x22c0cb80 self=0xab5c5d00
  | sysTid=8513 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x9573c920
  | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2 HZ=100
  | stack=0x9563a000-0x9563c000 stackSize=1038KB
  | held mutexes=
  #00  pc 0000000000048e38  /system/lib/libc.so (__epoll_pwait+20)
  #01  pc 000000000001a291  /system/lib/libc.so (epoll_pwait+60)
  #02  pc 000000000001a2c1  /system/lib/libc.so (epoll_wait+12)
  #03  pc 0000000000011e77  /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+118)
  #04  pc 0000000000011d73  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+26)
  #05  pc 0000000000096fbd  /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
  #06  pc 000000000067f0a5  /system/framework/arm/boot-framework.oat (Java_android_os_MessageQueue_nativePollOnce__JI+96)
  at android.os.MessageQueue.nativePollOnce (Native method)
  at android.os.MessageQueue.next (MessageQueue.java:323)
  at android.os.Looper.loop (Looper.java:136)
  at android.os.HandlerThread.run (HandlerThread.java:61)

I downgraded to version 4.40.0 and the issue has been resolved, but Facebook is constantly sending me alerts to update the SDK, how to solve? I lost thousands of users and several negative reviews.

Henrique Monte
  • 1,272
  • 1
  • 15
  • 22
  • Please add full stacktrace and attach the code which causes the issue. – Ernest Zamelczyk Aug 26 '19 at 12:44
  • I updated with the full stack trace. There is no project code reference, it simply froze to open. I just use Facebook SDK to login with Facebook using Firebase integration, but automatically it starts collecting data from Facebook Analytics, I suspect the problem has something to do with it. – Henrique Monte Aug 26 '19 at 19:35
  • If it is default facebook analytics/logging, you can turn it off.. refer.. https://stackoverflow.com/questions/39994292/how-to-opt-out-from-facebook-sdk-event-logging – TheAnkush Aug 29 '19 at 03:18
  • Same happening for me – Ilia Sidorenko Aug 29 '19 at 10:00
  • Which components of the SDK do you need (Login, Sharing, Core...)? Please attach to the question the code of where you use any API from Facebook SDK and as well how you wrote the dependency in gradle. – denis_lor Aug 30 '19 at 08:44
  • It's also reported in Facebook issue tracker: https://developers.facebook.com/support/bugs/1398287143658627/ maybe consider sharing it there and upvoting. – Yakuza Aug 30 '19 at 11:07
  • @Henrique Monte do you have in your gradle, dependency that has version with sign "+" in it for example: implementation 'org.springframework:spring-w:5.+' ? – peco Aug 30 '19 at 17:02
  • @denis_lor I followed the Firebase implementation guide, and they say to use lib "core" ('com.facebook.android:facebook-android-sdk:5.4.0'). But I just need to login via Facebook. – Henrique Monte Aug 30 '19 at 18:46
  • @peco No, I always use release versions. – Henrique Monte Aug 30 '19 at 18:47
  • Please see this article [Integrating FBSDK](https://medium.com/@mehran.khan/integrating-fbsdk-facebook-login-in-react-native-7b7600ce74a7) – Nooruddin Lakhani Aug 31 '19 at 10:51
  • Facebook team noticed the issue and fixed it in version 5.5.0. Commit: https://github.com/facebook/facebook-android-sdk/commit/856665c5e0ede060b3a0f18af8a808aba26d4778 – Henrique Monte Sep 01 '19 at 20:20

1 Answers1

2

The Facebook team noticed the issue and fixed it in version 5.5.0.

Commit: https://github.com/facebook/facebook-android-sdk/commit/856665c5e0ede060b3a0f18af8a808aba26d4778

Henrique Monte
  • 1,272
  • 1
  • 15
  • 22
  • 1
    what a mistake from Facebook! I have tons of ANRs reported thanks to them – Roberto Sep 02 '19 at 18:58
  • 1
    We had a terrible week here too. The largest amount of reports in our app's history. And users who are still in the old version and don't upgrade continue to generate tons of errors. – Henrique Monte Sep 02 '19 at 19:55