mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #230] Android: UnifiedPush registration with Schildichat broken since v1.11.0 #185
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#185
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 @binwiederhier on GitHub (Apr 30, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/230
As reported by Jakob on Discord:
@binwiederhier commented on GitHub (Apr 30, 2022):
As said on Discord, to me it looks like Schildi is sending the same registration twice within 5ms:
Looking at https://github.com/binwiederhier/ntfy-android/compare/v1.10.0...v1.11.0 (only
BroadcastReceiverandDistributor), it looks like I(i) got rid of
REGISTRATION_REFUSEDand replaced it withREGISTRATION_FAILED(ii) am now catching a
SQLConstraintExceptionand sendingREGISTRATION_FAILEDback. This was to address #185.My question to the UP guys (@karmanyaahm, @p1gp1g, @sparchatus)
(a) is the way that ntfy behaves (in the latest version, see log) now correct?
(b) are you in touch with the schildi devs to maybe let them know not to send the registration twice?
@binwiederhier commented on GitHub (Apr 30, 2022):
My guess is that (i) is incorrect, because: same app + same token -> return NEW_ENDPOINT, right?
@karmanyaahm commented on GitHub (May 2, 2022):
Yes, as Sparchatus said in the chat, it should return the same endpoint again if there's another call with same params.
@SpiritCroc
@SpiritCroc commented on GitHub (May 2, 2022):
Hm, if I remember correctly, from @p1gp1g's implementation, it re-registered on every app start. Will have a look when I find time.
@binwiederhier commented on GitHub (May 2, 2022):
Hi @SpiritCroc nice to meet you :-D
I was going totally insane for a while, because GitHub search doesn't show any results for
unifiedpushin the SchildiChat Android repo. Turns out the search is just broken. Good oldgrepon your repo saved the day.I briefly looked at the code, but not in an IDE, but it is entirely possible that
registerAppis called more than once under certain circumstances. I think I just have to make sure that theBroadcastReceiveron my end is race-safe.@SpiritCroc commented on GitHub (May 3, 2022):
Hi :)
Github search doesn't search code for projects with "fork" status unfortunately.
So will SchildiChat need changes, or is it fine as is?
@p1gp1g commented on GitHub (May 3, 2022):
Hi !
Ntfy should resend the new endpoint when it receives a new registration :)
https://unifiedpush.org/spec/android/#orgunifiedpushandroidconnectornew_endpoint
@binwiederhier commented on GitHub (May 3, 2022):
I mean while I of course agree, I think that the connector should maybe not send the same registration twice within 5ms (see above:
21:48:10.120and21:48:10.125). That makes it unnecessarily difficult, since now I have to lock/synchronize around something that happens once every full moon, but then happens twice at the exact same moment :-DI'll fix it on my end, np.
@SpiritCroc commented on GitHub (May 3, 2022):
I see, that indeed sounds unnecessary 🤔
@binwiederhier commented on GitHub (May 3, 2022):
Fixed in
github.com/binwiederhier/ntfy-android@821a1ac222-- this looks like a lot, but it's just aMutexaround the entire register/unregister call. Will be in the next release.I tested with MacroDroid tapping a floating action button many times. Since that didn't work I added an artificial
delay(200)after theexistscheck and that reproduced the error above.@SpiritCroc commented on GitHub (May 22, 2022):
Fixed in SchildiChat now as well, it was indeed trying to register twice when clicking "re-register push distributor" - my fault, sorry.
@binwiederhier commented on GitHub (May 22, 2022):
Nice. Thanks!