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

ANR at com.google.internal.firebase.inappmessaging.v1.sdkserving.InAppMessagingSdkServingGrpc$InAppMessagingSdkServingBlockingStub.fetchEligibleCampaigns (InAppMessagingSdkServingGrpc.java:222) #1430

Closed
belrvn opened this issue Apr 7, 2020 · 24 comments · Fixed by #1488

Comments

@belrvn
Copy link

belrvn commented Apr 7, 2020

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.4.1 ->3.6.1
  • Firebase Component: firebase-inappmessaging-display
  • Component version: 19.0.4

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

This is shown as an ANR report.
The problem is happening only in one version after "Downgrade to SDKs that use a version of Firebase InstanceId before v20.1.0. The easiest way to do this is to depend on Firebase Messaging v20.1.0 (or before) and lock the version of Firebase InstanceId to v20.0.2 in your Gradle file." as suggested in #1339

These were the only changes:

classpath com.android.tools.build:gradle: 3.4.1 ->3.6.1
classpath io.fabric.tools:gradle: 1.28.1 -> 1.31.2

com.google.firebase:firebase-messaging: 20.1.3 -> 20.1.0
added explicit com.google.firebase:firebase-iid:20.0.2
implementation('com.crashlytics.sdk.android:crashlytics: 2.5.2 -> 2.10.1 ') {
transitive = true
}

Relevant Code:

"main" prio=5 tid=1 Waiting
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x74695990 self=0x6f34014c00
  | sysTid=26280 nice=-10 cgrp=default sched=0/0 handle=0x6fba84e548
  | state=S schedstat=( 65587206081 31035698087 209749 ) utm=5200 stm=1358 core=6 HZ=100
  | stack=0x7fe1ffc000-0x7fe1ffe000 stackSize=8MB
  | held mutexes=
  at java.lang.Object.wait (Object.java)
- waiting on <0x02c37e9f> (a java.lang.Object)
  at java.lang.Thread.parkFor$ (Thread.java:2137)
- locked <0x02c37e9f> (a java.lang.Object)
  at sun.misc.Unsafe.park (Unsafe.java:358)
  at java.util.concurrent.locks.LockSupport.park (LockSupport.java:190)
  at io.grpc.stub.ClientCalls$ThreadlessExecutor.waitAndDrain (ClientCalls.java:660)
  at io.grpc.stub.ClientCalls.blockingUnaryCall (ClientCalls.java:132)
  at com.google.internal.firebase.inappmessaging.v1.sdkserving.InAppMessagingSdkServingGrpc$InAppMessagingSdkServingBlockingStub.fetchEligibleCampaigns (InAppMessagingSdkServingGrpc.java:222)
  at com.google.firebase.inappmessaging.internal.GrpcClient.fetchEligibleCampaigns (GrpcClient.java:38)
  at com.google.firebase.inappmessaging.internal.ApiClient.lambda$getFiams$0 (ApiClient.java:104)
  at com.google.firebase.inappmessaging.internal.ApiClient$$Lambda$1.then (ApiClient.java:5222)
  at com.google.android.gms.tasks.zzd.run (zzd.java:5)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:193)
  at android.app.ActivityThread.main (ActivityThread.java:6715)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:911)
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@JasonAHeron
Copy link
Contributor

@ashwinraghav Is this the bug that the FIS folks have been talking about when a user uses another SDK with FIS? messaging could cause that?

@stari4ek
Copy link

stari4ek commented Apr 15, 2020

I'm seeing this ANR in prod starting with update for com.google.firebase:firebase-inappmessaging from 19.0.3 to 19.0.4

  at java.lang.Object.wait (Object.java)
- waiting on <0x071fb630> (a java.lang.Object)
  at java.lang.Thread.parkFor$ (Thread.java:2137)
- locked <0x071fb630> (a java.lang.Object)
  at sun.misc.Unsafe.park (Unsafe.java:358)
  at java.util.concurrent.locks.LockSupport.park (LockSupport.java:190)
  at io.grpc.stub.ClientCalls$ThreadlessExecutor.waitAndDrain (ClientCalls.java:660)
  at io.grpc.stub.ClientCalls.blockingUnaryCall (ClientCalls.java:132)
  at com.google.internal.firebase.inappmessaging.v1.sdkserving.InAppMessagingSdkServingGrpc$InAppMessagingSdkServingBlockingStub.fetchEligibleCampaigns (InAppMessagingSdkServingGrpc.java:222)
  at com.google.firebase.inappmessaging.internal.GrpcClient.fetchEligibleCampaigns (GrpcClient.java:38)
  at com.google.firebase.inappmessaging.internal.ApiClient.lambda$getFiams$0 (ApiClient.java:104)
  at com.google.firebase.inappmessaging.internal.ApiClient$$Lambda$1.then (ApiClient.java:65)
  at com.google.android.gms.tasks.zzd.run (zzd.java:5)

I get it for all my activities and for broadcast events: com.google.firebase.MESSAGING_EVENT

@evasua
Copy link

evasua commented Apr 15, 2020

All my users who use a firewall (for example NetGuard) and block the internet for my application have this ANR too during the starting of the app.
"com.google.firebase:firebase-messaging:20.1.5"
"com.google.firebase:firebase-inappmessaging-display:19.0.5"
"com.google.firebase:firebase-analytics:17.3.0"

@JasonAHeron
Copy link
Contributor

Hey folks, I'm looking into this now. @stari4ek does this happen on 19.0.5 for you?
@evasua Is this resolved on 19.0.3 for you?

@JasonAHeron
Copy link
Contributor

@evasua can you try following the instructions from the above ANR report and see if that fixes it for you.

Specifically locking instance id to v20.0.2 or downgrading messaging to v20.1.0

@stari4ek
Copy link

stari4ek commented Apr 16, 2020

Hey folks, I'm looking into this now. @stari4ek does this happen on 19.0.5 for you?

Didn't check. I'm rolling out hotfix update with fiam rolled-back to 19.0.3

@JasonAHeron
Copy link
Contributor

Hey I think I understand what's happening here. Past 19.0.3 we changed to using a better async handling for our dependency on Firebase instance id. However this async work was unintentionally happening on the UI thread which means in the case where the network is down and the async work hangs we block the UI thread. This is my current working theory, I'm hoping to validate this and then have a fix ready asap

@JasonAHeron
Copy link
Contributor

Another quick update here. I am able to reproduce this issue using NetGuard. Fix coming soon

@ubuntudroid
Copy link

@JasonAHeron Any ETA for the fix? ANRs have spiked extremely after upgrading to the latest Firebase SDKs. :(

@JasonAHeron
Copy link
Contributor

Hey, sorry a couple other fires to put out. I am dedicating all day today to this so hopefully I can get the fix ready by today or tomorrow. I can release this fix as a hotpatch so it will go out as soon as I can get it working and tested. From what I can see, the only way to repro is to disable network to the app using a VPN, have you folks reproduced this any other way?

@ubuntudroid
Copy link

@JasonAHeron No, I unfortunately couldn't - however, looking at the rate of our ANRs I doubt that so many people are having their VPNs enabled. The spike even briefly made us cross Google Play's bad behavior threshold (which currently is at 0.47%) - so it is really affecting a lot of users out there.

@JasonAHeron JasonAHeron linked a pull request Apr 21, 2020 that will close this issue
@stari4ek
Copy link

btw, reverting to 19.0.3 fixed the issue. I do not see ANR due fiam in new release

@danibwuoy
Copy link

Yes @stari4ek , reverting to 19.0.3 did solve the issue for me as well.

@belrvn
Copy link
Author

belrvn commented Apr 22, 2020

btw, reverting to 19.0.3 fixed the issue. I do not see ANR due fiam in new release

@stari4ek Which other versions do you have ? For us we still have ANR problem with the current versions:

implementation "com.google.firebase:firebase-messaging:20.1.0"
implementation "com.google.firebase:firebase-iid:20.0.2"
implementation "com.google.firebase:firebase-inappmessaging-display:19.0.3"

@stari4ek
Copy link

Here is all firebase deps I have:

implementation 'com.google.firebase:firebase-analytics:17.3.0'
implementation 'com.google.firebase:firebase-perf:19.0.6'
implementation 'com.google.firebase:firebase-config:19.1.3'
implementation 'com.google.firebase:firebase-messaging:20.1.5'
implementation 'com.google.firebase:firebase-functions:19.0.2'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation 'com.google.firebase:firebase-firestore:21.4.2'
implementation 'com.google.firebase:firebase-storage:19.1.1'
implementation 'com.google.firebase:firebase-inappmessaging:19.0.3'
implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.3'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta04'

I do not have direct dependency tofirebase-iid

@JasonAHeron
Copy link
Contributor

Fix merged into master, I'll try to get a hotfix release out asap.

@JasonAHeron JasonAHeron reopened this Apr 22, 2020
@JasonAHeron
Copy link
Contributor

Hey friends, we're going to be releasing this as a part of the official release coming tomorrow. So you should see fiam 19.0.6 available at that time. I'll leave this open and close it when the new dependency is available and verified.

@ubuntudroid
Copy link

Any news here? We are desperately waiting fo the SDK update to release a fix for our app before the weekend to get it out of the bad behavior zone.

@JasonAHeron
Copy link
Contributor

Yep! We released 19.0.6 last night. I can leave this issue open until you verify that its fixed on your end. If I get no more responses here I'll close the issues in a few days because as far as I know it's fixed.

@ubuntudroid
Copy link

@JasonAHeron Thanks a lot! 🤗 I checked https://firebase.google.com/support/release-notes/android#latest_sdk_versions and didn't see it there so I assumed that it's not live yet.

I'll report back if the issue still persists.

@JasonAHeron
Copy link
Contributor

JasonAHeron commented Apr 24, 2020

Yes, that is normally the place to go. I think the release notes are just delayed a bit but the artifacts are available so you should be able to update you dependency now. Release notes should be updated today

@ubuntudroid
Copy link

@JasonAHeron things are looking good so far - no more ANRs so far. Seems this is fixed. 🙏 If it starts popping up again I'll post here in a few days after Play Console shows full statistics.

@JasonAHeron
Copy link
Contributor

Alright I'm closing this issue.

@firebase firebase locked and limited conversation to collaborators May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants