FCM duplicate notifications

9,369 views
Skip to first unread message

Carl Tidelius

unread,
Apr 23, 2021, 5:19:13 AM4/23/21
to Firebase Google Group
Hello!

We're using FCM to send to batched groups of tokens, ranging from 20k to 600k tokens. 
We've recently switched from using a third party source, Airship, to use our own solution when doing this.
While it may sound like a problem exists in our solution, we're using a set of tokens, so no duplicated ones, and we're checking so that no push notification is being sent twice from our backend. 

Our problem is that sometimes we receive a duplicate notification in our tray, we have about 10 phones subscribed to our pushes, and they do not receive the same duplicate notifications. 

We're sending about 30 notifications a day, and about once every other day someone receives a duplicated notification. This happens on both Android and iOS-devices

We've searched github for similar issues, but have not found an answer that could fix our problems.

We're at our wits end, and are reaching out to you to see if anyone has had a similar problem, or if there's a known problem in FCM that can cause this.

Best Regards,
Carl

Kato Richardson

unread,
Apr 27, 2021, 12:29:24 PM4/27/21
to Firebase Google Group
Hi Carl,

I haven't heard of any other developers running into duplicate tokens. No known issues. 

My first instinct would be some sort of retry error either on your send to the API or on the send from Google to the client device. The former should be easy enough to log and detect. The latter can be tricky; devices and carriers may deliver the message but fail to report back in some edge cases, causing the service to resend. But I'm fairly sure this is both a long shot and that duplication detection would take care of these. However, you should be able to find some resources for troubleshooting here, and adding some sophisticated logging to the client for test devices would probably help narrow the possible causes.

My second instinct would be that there is an error in the batching and tokens are getting included in more than one batch (edge overlap/off-by-one error).

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/91942579-3a78-466c-a5d4-0e5f349b59dbn%40googlegroups.com.


--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Carl Tidelius

unread,
May 4, 2021, 4:47:33 AM5/4/21
to Firebase Google Group
Hey Kato, 

Well, the issue isn't duplicate tokens, as far as we are aware. We are using a set of tokens, which means that we shouldn't have any duplicated tokens even if we've saved duplicated in firestore. 

Off-by-one or Edge overlaps shouldn't be the problem either, as we've seen triplicates or quadruplicate pushes. Whereas these errors should only result in duplicated pushes.

Our test devices (and users) all receive duplicate notifications, randomly. Our test devices does not receive the same duplicate notification, and it's only sporadically. That is, maybe every 70th message gets duplicated/triplicated/quadruplicated.

One suspect right now is that we have both FCM and Airship (formerly known as Urban Airship) in our project code, but are only subscribed to one at a time. This was done to make a transition over to FCM smoothly. 
Though we've tried to build apps with no Airship-code and a completely new token that is not registered to Airship, which still results in duplicated pushes.

We are not using any retries on failed batches, unless there are any built in retries that retries batches if too many tokens fails?

We're gonna check out the tips you gave us though :) Thank you for that!

Best Regards,
Carl

Kato Richardson

unread,
May 4, 2021, 12:55:18 PM5/4/21
to Firebase Google Group
After you check on those, if you don't see any improvement, recommend collecting BigQuery logs, device logs, and some example token/app bundle id(a.k.a. package name)/timestamps/sender id and send those over to support. Feel free to CC me on the thread.

☼, Kato

Carl Tidelius

unread,
May 5, 2021, 10:16:19 AM5/5/21
to Firebase Google Group
Hey Kato, 

I think we've narrowed it down to be the retries in the Firebase Admin Node SDK. When we are getting a time out, the message is still being sent, and the retries sends another notification. 
I've opened up a support ticket, but I couldn't see an option to CC you. This is the Case number: 00132354

Thanks for you help :) 
Carl
Reply all
Reply to author
Forward
0 new messages