mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #316] Bug: iOS notifications sometimes received twice #245
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#245
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @robfox92 on GitHub (Jun 7, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/316
I have a script that runs every day at 00:00, and will sometimes send a notification. This morning I saw two notifications on my phone - one at 00:00 and one at 00:07. On my (self-hosted) ntfy I only see a single notification in the web UI (at 00:00). In the ntfy ios app I also see a single notification for 00:00.
It seems like the popup notification was sent twice for some reason? I'll try and replicate it later today.
@binwiederhier commented on GitHub (Jun 7, 2022):
Do they show in the UI twice? I am pretty sure I have experienced this as well, but I thought I imagined it. Since I don't use an iOS device myself during day to day, it is much less likely to happen to me.
Try hard-killing the app and seeing if you see one or two notifications in the list.
@binwiederhier commented on GitHub (Jun 7, 2022):
Note to self: my guess is that this is another one of those Core Data inconsistencies across processes.
@robfox92 commented on GitHub (Jun 7, 2022):
I made the mistake of clearing the notifications before taking a screenshot - I'm trying to replicate again and will grab one if I can.
The duplicate notifications just appeared in the notifications tray. Only a single one showed in the ntfy app.
Site note - how do I put a label on this issue?
@robfox92 commented on GitHub (Jun 7, 2022):
It's potentially related to "do not disturb" mode. I just turned it on, sent 1 notification via the web ui and after a few minutes I turned off dnd mode.
@binwiederhier commented on GitHub (Jun 8, 2022):
That's a good lead, thank you. I'll investigate this when I get to it.
Here's my current hunch:
Every 20 minutes or so, the app polls for new messages from the server. If a message is not in the local database, it'll display it as a local notification. If the remote message eventually arrives via Firebase, there is no way for me to silence the notification. It's impossible without the "notification filtering entitlement", which Apple denied me when I requested it.
It could be that in DND mode, messages arrive neither via Firebase, nor is polling allowed to execute. Once you come out of DND, both run at the same time and race, and two notifications are displayed. That's just a guess though. I'd have to test it.
@milksteakjellybeans commented on GitHub (Jun 12, 2022):
I got this overnight. I have a parrot tell me everything is still working at 4am.
Latest iOS app, Latest ntfy server via docker self hosted, it was during nightly fixed DND time for both notifications. Screen shots if it's helpful.
@binwiederhier commented on GitHub (Jun 12, 2022):
Thanks. Definitely helpful to confirm it. I wish I could ask you for logs, but I haven't figured out how to write/persist them in iOS so you can share them (like I did in Android). That would make things so much easier.
@robfox92 commented on GitHub (Jun 13, 2022):
I set up a cron job to send myself a notification at 1am every day (while quiet hours are on) and this morning the notifications had timestamps of 01:00 and 01:15.
Are more screenshots helpful at this point?
If you get a testflight build set up to try and pinpoint this I'm keen to run it.
@milksteakjellybeans commented on GitHub (Jun 17, 2022):
It seems like what might be happening here is that the iOS instant notification is received and if there is no interaction with the phone or ntfy app, the non-instant version of the notification also eventually makes its way to the phone and you get the double notification. This is only conjecture from my observations using the iOS app and not anything deeper than that. (and I have not upgraded beyond 1.25.2 server yet)
@majoragee commented on GitHub (Jul 16, 2022):
I can also confirm duplicate notifications arriving 5-15 minutes later than the original. I will add that I do not use Do Not Disturb but I still experience the issue when I don't open the app to look at the notification. The correlation to Do Not Disturb may be a coincidence. The app itself does not show duplicate messages - the issue is only with notifications.
I've been loving this service and the new iOS app. Keep up the great work!
@binwiederhier commented on GitHub (Jul 27, 2022):
So my guess is that this is caused by two things:
lastNotificationIdfield and then polls using/mytopic/json?since=$id. This ID is coming from Core Data.The issue is this (this is a GUESS!): The Core Data database is not properly in sync between the main app and the NSE, which means the
lastNotificationIdis out of sync, so messages are delivered/displayed twice. This is bug https://github.com/binwiederhier/ntfy/issues/316.This causes another bug too, where the UI does not reflect all messages all the time (this is: https://github.com/binwiederhier/ntfy/issues/337). It is annoying and it just shows that I don't know how Core Data works internally. It could also be a bug, but it's annoying.
Again, this is just a guess.
Debugging this is next to impossible, because
Before you ask "what the heck": 90% of this is Apple's fault, of how the NSE and all that work. The problem with Core Data is obviously my fault, but I have no time currently to debug this or spend any time with it.
@notDavid commented on GitHub (Nov 9, 2022):
Fyi, arriving shortly after another within a few seconds (i think it was less than ~ 10 seconds.) Can not reproduce again right after this screenshot...
@ghost commented on GitHub (Jan 30, 2023):
Seeing the same issue. Self hosted install. Notifications always seem to be 7 minutes apart.
Thanks for everything
@binwiederhier commented on GitHub (Mar 31, 2023):
I do believe this is fixed by #677/#509 -- If it still happens, please comment here and I'll re-open.