firebase / firebase/firebase-admin-java

NullPointerException when using cloud messaging

未关闭
#1,081 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
needs-triage
主要语言
Java
星标
620
派生
305
平均合并
3 小时 23 分钟
30 天内合并 PR
1

描述

* Library version: 9.4.3
* Firebase Product: cloud messaging

When we are sending messages in bulk to devices using device specific tokens, we randomly get the error below:

```
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:595)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:574)
at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91)
at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:67)
at businessLayer.Messaging.sendPush(Messaging.java:777)
...
```

We are using the method sendEachAsync:
`BatchResponse firebaseResponse = FirebaseMessaging.getInstance(firebaseApp).sendEachAsync(firebaseMessages, pushDryRun).get();`

Besides the error showing up randomly when we are sending the messages, it seems that in older version of the library (<= 9.3.0), that the error is:

```
java.util.concurrent.ExecutionException: com.google.firebase.messaging.FirebaseMessagingException: com.google.firebase.messaging.FirebaseMessaging
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:594)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:573)
at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91)
at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:67)
at businessLayer.Messaging.sendPush(Messaging.java:777)
...
```

The problem for us is that it seems that this error started showing up randomly last month.
At least some messages seem to be sent, because we have info that users are seeing and clicking on the notifications.
So, it seems that we are correctly calling the procedure.
Any help would be welcomed.

贡献指南

打开贡献指南

调研方向

Start at the sendEachAsync call and businessLayer.Messaging.sendPush in Messaging.java:777, then reproduce a bulk send to device-specific tokens on library version 9.4.3. Trace why the asynchronous result becomes a NullPointerException instead of the older FirebaseMessagingException, and verify that bulk sends report an actionable error while successful notifications remain unaffected.

由索引模型根据 Issue 内容生成。

评估

技术栈
firebase, java
领域
backend, cloud
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。