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

Notifications not clearing after sync #4862

Open
benparsons opened this issue Jan 5, 2022 · 27 comments
Open

Notifications not clearing after sync #4862

benparsons opened this issue Jan 5, 2022 · 27 comments
Labels
A-Notifications O-Frequent Affects or can be seen by most users regularly or impacts most users' first experience S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Something isn't working: bugs, crashes, hangs and other reported problems

Comments

@benparsons
Copy link
Member

Steps to reproduce

  1. I get messages
  2. Android shows me a notification
  3. I read the messages on element-web
  4. I get more messages
  5. Android updates the notification to show me, but those messages I already read are still shown in the notification

Outcome

What did you expect?

Read messages are cleared from notifications

What happened instead?

They remain.

Your phone model

Samsung S20FE

Operating system version

Android 11

Application version and app store

1.3.12

Homeserver

No response

Will you send logs?

No

@benparsons benparsons added the T-Defect Something isn't working: bugs, crashes, hangs and other reported problems label Jan 5, 2022
@ouchadam ouchadam added A-Notifications O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Impairs non-critical functionality or suitable workarounds exist labels Jan 5, 2022
@ouchadam
Copy link
Contributor

ouchadam commented Jan 5, 2022

does this happen for all rooms/chats?

I've seen this issue happen in the past when the message read push events are not sent due to push rules, I was able to get them working again by setting the room notifications to none and back to all

@benparsons
Copy link
Member Author

I don't think this is uncommon, multiple customers and IRL friends report it, and I see it as basically my normal experience with the android app.

You could be right, that this is caused by push rules not being correctly set, next time I see this on a specific room I will toggle the notification settings for that room and see if it helps.

@ouchadam
Copy link
Contributor

ouchadam commented Jan 6, 2022

I don't think this is uncommon, multiple customers and IRL friends report it, and I see it as basically my normal experience with the android app.

ah wasn't aware of more reports, happy to bump it up

@ouchadam ouchadam added O-Occasional Affects or can be seen by some users regularly or most users rarely and removed O-Uncommon Most users are unlikely to come across this or unexpected workflow labels Jan 6, 2022
@benparsons
Copy link
Member Author

Naturally, now I've just tested this to see if I could try the push-rules question, I couldn't repo at all..! So, I will try to get a better repro and come back with more info.

@ouchadam
Copy link
Contributor

ouchadam commented Jan 6, 2022

if possible that would be great! the push flows are quite tricky as there's so many moving parts (firebase cloud messaging tokens, google play services availability, OEM battery optimisations, cross client push rules config, sygnal and the /sync)

@abmantis
Copy link

abmantis commented Mar 6, 2022

I've been also having this issue frequently now. Notifications arrive on time, but then most of the times they stay on the phone until I open Element. Once in a while. it works as expected and the notification is cleared automatically, but most of the times it is not.
I already changed the room notification settings to Off and back to On on the app, but the problem persists.

@hho
Copy link

hho commented Mar 28, 2022

This has been an issue for me recently as well - I think it started in January this year (it used to work perfectly before).

  • Pixel 6
  • Element Android Beta
  • hosting my own Synapse; never more than a week behind release of Debian packages

@ouchadam ouchadam added O-Frequent Affects or can be seen by most users regularly or impacts most users' first experience and removed O-Occasional Affects or can be seen by some users regularly or most users rarely labels Apr 12, 2022
@BloodyIron
Copy link

BloodyIron commented Apr 12, 2022

This happens literally 100% of the time for me across all android devices I own. So I would not say "frequent" I would say "always" for frequency. I'm seriously not exaggerating here too, it actually is 100%.

@f35f0ef9d0e827dae86552d3899f78fc

I would like to add that this is not isolated to Android; the same behavior folks have been describing here has been happening on iOS for quite a while (a few months?) as well.

@marius
Copy link

marius commented May 11, 2022

Yeah, this is really annoying. Has anyone found a workaround?

@BloodyIron
Copy link

Yeah this is still happening for all android devices in my Sphere of Influence(tm)

@SpiritCroc
Copy link
Contributor

SpiritCroc commented May 12, 2022

For those issues with notifications not dismissing when read on another client until opening Element Android, this should be the fix on synapse, which was not doing push as expected: matrix-org/synapse#12721
This does however not address the original issue above. In particular, if at "4. I get more messages" notifications aren't dismissed, there's something else broken as far as I see.

@BloodyIron
Copy link

ETA before that hits production public matrix servers?

@SpiritCroc
Copy link
Contributor

ETA before that hits production public matrix servers?

The synapse team needs to review the PR first (I'm only a third party contributor) before it'll get included in any release. You can follow the linked PR for updates.

@hho
Copy link

hho commented May 13, 2022

@SpiritCroc Thank you so much!! I monkey-patched my Synapse installation with the line from your PR and it works beautifully again!

@SpiritCroc
Copy link
Contributor

@SpiritCroc Thank you so much!! I monkey-patched my Synapse installation with the line from your PR and it works beautifully again!

Great, thanks for testing and reporting!

@wodny
Copy link

wodny commented May 27, 2022

On Android (Element) notifications from the matrix.org instance disappear as excepted (again) after a message is read in web Element app. Thanks.

SpiritCroc added a commit to SpiritCroc/element-android that referenced this issue May 30, 2022
Persisting notification info fails for non-null Uris:

E NotificationEventPersistence: ## Failed to save cached notification info
E NotificationEventPersistence: java.io.NotSerializableException: android.net.Uri$HierarchicalUri
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1240)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1604)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1565)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1488)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1234)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:354)
E NotificationEventPersistence: 	at java.util.ArrayList.writeObject(ArrayList.java:762)
E NotificationEventPersistence: 	at java.lang.reflect.Method.invoke(Native Method)
E NotificationEventPersistence: 	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1036)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1552)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1488)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1234)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:354)
E NotificationEventPersistence: 	at org.matrix.android.sdk.internal.session.securestorage.SecretStoringUtils.saveSecureObjectM(SecretStoringUtils.kt:283)
E NotificationEventPersistence: 	at org.matrix.android.sdk.internal.session.securestorage.SecretStoringUtils.securelyStoreObject(SecretStoringUtils.kt:150)
E NotificationEventPersistence: 	at org.matrix.android.sdk.internal.session.securestorage.DefaultSecureStorageService.securelyStoreObject(DefaultSecureStorageService.kt:27)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationEventPersistence.persistEvents(NotificationEventPersistence.kt:58)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationDrawerManager$persistEvents$1.invoke(NotificationDrawerManager.kt:183)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationDrawerManager$persistEvents$1.invoke(NotificationDrawerManager.kt:182)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationState.queuedEvents(NotificationState.kt:55)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationDrawerManager.persistEvents(NotificationDrawerManager.kt:182)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationDrawerManager.refreshNotificationDrawerBg(NotificationDrawerManager.kt:177)

Accordingly, if a notification for an image is shown, and the
notification state is loaded from storage later, none of the previously
shown notifications will get dismissed once read.

Likely addresses element-hq#4862.

Change-Id: I2d6be497e8b92e770b680e16e42b3610add57323
piersonleo pushed a commit to piersonleo/element-android that referenced this issue Jun 7, 2022
Persisting notification info fails for non-null Uris:

E NotificationEventPersistence: ## Failed to save cached notification info
E NotificationEventPersistence: java.io.NotSerializableException: android.net.Uri$HierarchicalUri
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1240)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1604)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1565)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1488)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1234)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:354)
E NotificationEventPersistence: 	at java.util.ArrayList.writeObject(ArrayList.java:762)
E NotificationEventPersistence: 	at java.lang.reflect.Method.invoke(Native Method)
E NotificationEventPersistence: 	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1036)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1552)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1488)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1234)
E NotificationEventPersistence: 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:354)
E NotificationEventPersistence: 	at org.matrix.android.sdk.internal.session.securestorage.SecretStoringUtils.saveSecureObjectM(SecretStoringUtils.kt:283)
E NotificationEventPersistence: 	at org.matrix.android.sdk.internal.session.securestorage.SecretStoringUtils.securelyStoreObject(SecretStoringUtils.kt:150)
E NotificationEventPersistence: 	at org.matrix.android.sdk.internal.session.securestorage.DefaultSecureStorageService.securelyStoreObject(DefaultSecureStorageService.kt:27)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationEventPersistence.persistEvents(NotificationEventPersistence.kt:58)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationDrawerManager$persistEvents$1.invoke(NotificationDrawerManager.kt:183)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationDrawerManager$persistEvents$1.invoke(NotificationDrawerManager.kt:182)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationState.queuedEvents(NotificationState.kt:55)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationDrawerManager.persistEvents(NotificationDrawerManager.kt:182)
E NotificationEventPersistence: 	at im.vector.app.features.notifications.NotificationDrawerManager.refreshNotificationDrawerBg(NotificationDrawerManager.kt:177)

Accordingly, if a notification for an image is shown, and the
notification state is loaded from storage later, none of the previously
shown notifications will get dismissed once read.

Likely addresses element-hq#4862.

Change-Id: I2d6be497e8b92e770b680e16e42b3610add57323
@CyberShadow
Copy link

I'm seeing notifications from keywords not clearing with Element-Android 1.4.27 and Synapse v1.60.0.

Notifications for things like private messages are being cleared.

The notification stays even in I open Element-Android, and only goes away when I open the room that the notification was generated in.

Is it possible that there's a similar bug with sending pushes for clearing keyword notifications?

@BloodyIron
Copy link

So this "fix" has hit production, and initially it improved things, but now Element Android does not seem to be lazy-loading when a device is idle/low power, and again notifications are not being cleared until a device starts getting used again... It seems one solution leads to another problem :O

@CyberShadow
Copy link

Still seeing this in Element-Android 1.6.12.

@BloodyIron
Copy link

Frankly notifications for Element Android have become so extremely unreasonably unreliable, I've just switched to schildichat and I'll probably dump Element Android soon. As I'm testing both at the same time, schildichat so far is worlds more reliable for receiving, sending, clearing, and other notification stuff that I can't remember this moment.

@CyberShadow
Copy link

That's surprising, as SchildiChat is an Element fork, so I'd expect it to inherit Element's bugs.

https://github.com/SchildiChat/SchildiChat-android/blob/sc/FEATURES.md lists two small notification-related features, but nothing about reliability.

Are you perhaps using SchildiChat Next (which is very different)?

@abmantis
Copy link

That's surprising, as SchildiChat is an Element fork, so I'd expect it to inherit Element's bugs.

https://github.com/SchildiChat/SchildiChat-android/blob/sc/FEATURES.md lists two small notification-related features, but nothing about reliability.

Are you perhaps using SchildiChat Next (which is very different)?

I also have the same experience as @BloodyIron . On multiple occasions I've switched to SchildiChat (not Next) because of notification issues.

@SpiritCroc
Copy link
Contributor

As far as I remember I have upstreamed all notification reliability fixes I did for SchildiChat, so don't know why it would differ from Element right now

@BloodyIron
Copy link

BloodyIron commented Mar 27, 2024

That's surprising, as SchildiChat is an Element fork, so I'd expect it to inherit Element's bugs.

https://github.com/SchildiChat/SchildiChat-android/blob/sc/FEATURES.md lists two small notification-related features, but nothing about reliability.

Are you perhaps using SchildiChat Next (which is very different)?

Well proof's in the pudding, it's been head and shoulders more reliable for me and multiple other people around me than the Element Android app. Software can regress by the way, which is the case with Element frankly. Like there have been sooooooo many notification regressions, bugs, and problems over the years with Element alone. I previously chalked it up to "cutting their teeth" growing pain stuff, but at this point, it's just straight up unacceptably unreliable.

From a motivations perspective it's extremely surprising that notification reliability is not one of the top priorities a chat app cares about.

Also, I am not rocking SchildiChat Next. This is what I'm rocking : https://play.google.com/store/apps/details?id=de.spiritcroc.riotx&hl=en_CA&gl=US

@BloodyIron
Copy link

As far as I remember I have upstreamed all notification reliability fixes I did for SchildiChat, so don't know why it would differ from Element right now

Your efforts are appreciated, thanks!

@CyberShadow
Copy link

As I'm testing both at the same time, schildichat so far is worlds more reliable for receiving, sending, clearing, and other notification stuff that I can't remember this moment.

I can confirm that SchildiChat does not have the stuck notifications problem!

After I clear the notifications on my PC, they disappear from SchildiChat after a minute or so.

As far as I remember I have upstreamed all notification reliability fixes I did for SchildiChat, so don't know why it would differ from Element right now

Interesting - I'm wondering if this could somehow be related to a difference in the push mechanism. Could it be something like Element and Element X using GCM (and Synapse having bugs with it), but SchildiChat using polling (which is less efficient but also not having push bugs)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Notifications O-Frequent Affects or can be seen by most users regularly or impacts most users' first experience S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Something isn't working: bugs, crashes, hangs and other reported problems
Projects
None yet
Development

No branches or pull requests

10 participants