Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

/notifications returning stale outdated results #15140

@MadLittleMods

Description

@MadLittleMods

Description

As reported in element-hq/element-web#24616 (see "2. When the notification panels shows some old outdated notifications"), /notifications appears to be returning stale, outdated results.

When opening the notification panel in Element, it makes a request to https://gitter.ems.host/_matrix/client/r0/notifications?limit=20&only=highlight which returns some results (only 7) and these are from September 2021. And it also makes another paginated request, https://gitter.ems.host/_matrix/client/r0/notifications?limit=20&only=highlight&from=6554474 using the next_token from the previous request for the ?from in this request.

1: https://gitter.ems.host/_matrix/client/r0/notifications?limit=20&only=highlight

Response
{
	"notifications": [
		{
			"room_id": "!dqBkUNHOHmuFWvsiHH:gitter.im",
			"profile_tag": null,
			"actions": [
				"notify",
				{
					"set_tweak": "sound",
					"value": "default"
				},
				{
					"set_tweak": "highlight"
				}
			],
			"ts": 1631394783651,
			"event": {
				"content": {
					"body": "> <@elliria-5e77940ad73408ce4fdd9fb6:gitter.im> I messed around with it extensively today to get all the details for a bug report and found that it can't be consistently repeated, but only happens some of the time. Should I still file it if it's inconsistent?\n\nYup",
					"format": "org.matrix.custom.html",
					"formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!dqBkUNHOHmuFWvsiHH:gitter.im/$CjLS68tmWZ2q1gO5iU69cw-Oxq3wleZjKKm0dPmi25o?via=kde.org&via=gitter.im&via=matrix.org\">In reply to</a> <a href=\"https://matrix.to/#/@elliria-5e77940ad73408ce4fdd9fb6:gitter.im\">@elliria-5e77940ad73408ce4fdd9fb6:gitter.im</a><br />I messed around with it extensively today to get all the details for a bug report and found that it can&#39;t be consistently repeated, but only happens some of the time. Should I still file it if it&#39;s inconsistent?</blockquote></mx-reply>Yup",
					"m.relates_to": {
						"m.in_reply_to": {
							"event_id": "$CjLS68tmWZ2q1gO5iU69cw-Oxq3wleZjKKm0dPmi25o"
						}
					},
					"msgtype": "m.text"
				},
				"origin_server_ts": 1631394783403,
				"sender": "@silico_biomancer:kde.org",
				"type": "m.room.message",
				"unsigned": {
					"age": 45707853657
				},
				"event_id": "$1YeLgxM_rdcx1cSpTFKBobbJbLVeapUUQvR3oyMHrb4"
			},
			"read": true
		},
		{
			"room_id": "!dqBkUNHOHmuFWvsiHH:gitter.im",
			"profile_tag": null,
			"actions": [
				"notify",
				{
					"set_tweak": "sound",
					"value": "default"
				},
				{
					"set_tweak": "highlight"
				}
			],
			"ts": 1631394775876,
			"event": {
				"content": {
					"body": "> <@elliria-5e77940ad73408ce4fdd9fb6:gitter.im> Yep, that's one of the two methods I tried. I tried PIP and Git. I'd love complete step-by-step instructions from someone who uses Kubuntu from start to finish, with finish being AutoKey opened on the desktop and ready to go, because so far it's making me feel like a complete idiot. I'll give it one more go to see if I can solve it on my own, but am going to take a break for the moment and get away from it.\n\nHow did pip go wrong?",
					"format": "org.matrix.custom.html",
					"formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!dqBkUNHOHmuFWvsiHH:gitter.im/$6-Uox14OfobfZV6KD1If7imprr7KM9ipszTANN9kGCY?via=kde.org&via=gitter.im&via=matrix.org\">In reply to</a> <a href=\"https://matrix.to/#/@elliria-5e77940ad73408ce4fdd9fb6:gitter.im\">@elliria-5e77940ad73408ce4fdd9fb6:gitter.im</a><br />Yep, that&#39;s one of the two methods I tried. I tried PIP and Git. I&#39;d love complete step-by-step instructions from someone who uses Kubuntu from start to finish, with finish being AutoKey opened on the desktop and ready to go, because so far it&#39;s making me feel like a complete idiot. I&#39;ll give it one more go to see if I can solve it on my own, but am going to take a break for the moment and get away from it.</blockquote></mx-reply>How did pip go wrong?",
					"m.relates_to": {
						"m.in_reply_to": {
							"event_id": "$6-Uox14OfobfZV6KD1If7imprr7KM9ipszTANN9kGCY"
						}
					},
					"msgtype": "m.text"
				},
				"origin_server_ts": 1631394775400,
				"sender": "@silico_biomancer:kde.org",
				"type": "m.room.message",
				"unsigned": {
					"age": 45707861660
				},
				"event_id": "$k5BUicg6rN27kzzs3UfWAU33WcIxo71v-2wSh7tJlAM"
			},
			"read": true
		},
		{
			"room_id": "!dqBkUNHOHmuFWvsiHH:gitter.im",
			"profile_tag": null,
			"actions": [
				"notify",
				{
					"set_tweak": "sound",
					"value": "default"
				},
				{
					"set_tweak": "highlight"
				}
			],
			"ts": 1631305498705,
			"event": {
				"content": {
					"body": "> <@elliria-5e77940ad73408ce4fdd9fb6:gitter.im> I'm glad you fixed it. As to the beta, I wrestled with it in a variety of ways yesterday to try to install and use it in a VM with no success. I like to think that I'm not an idiot, but it's defeating me. Do you (or does anyone) have fool-proof step-by-step instructions for successfully installing, updating, and running the beta and/or any of the other development versions (if there are others that can be run)?\n\n`pip install --pre autokey` is probably the easiest way, but then there are a few system dependecies you'll need",
					"format": "org.matrix.custom.html",
					"formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!dqBkUNHOHmuFWvsiHH:gitter.im/$CSnHh_MqeKt_YfT3rzmmQOLakgdoqS9ueoCWUHXf9U0?via=kde.org&via=gitter.im&via=matrix.org\">In reply to</a> <a href=\"https://matrix.to/#/@elliria-5e77940ad73408ce4fdd9fb6:gitter.im\">@elliria-5e77940ad73408ce4fdd9fb6:gitter.im</a><br />I&#39;m glad you fixed it. As to the beta, I wrestled with it in a variety of ways yesterday to try to install and use it in a VM with no success. I like to think that I&#39;m not an idiot, but it&#39;s defeating me. Do you (or does anyone) have fool-proof step-by-step instructions for successfully installing, updating, and running the beta and/or any of the other development versions (if there are others that can be run)?</blockquote></mx-reply>`pip install --pre autokey` is probably the easiest way, but then there are a few system dependecies you'll need",
					"m.relates_to": {
						"m.in_reply_to": {
							"event_id": "$CSnHh_MqeKt_YfT3rzmmQOLakgdoqS9ueoCWUHXf9U0"
						}
					},
					"msgtype": "m.text"
				},
				"origin_server_ts": 1631305498539,
				"sender": "@silico_biomancer:kde.org",
				"type": "m.room.message",
				"unsigned": {
					"age": 45797138521
				},
				"event_id": "$45NYvSz6sBbqayexby5irf71_pWVUD_kM53PtdDeOh8"
			},
			"read": true
		},
		{
			"room_id": "!dqBkUNHOHmuFWvsiHH:gitter.im",
			"profile_tag": null,
			"actions": [
				"notify",
				{
					"set_tweak": "sound",
					"value": "default"
				},
				{
					"set_tweak": "highlight"
				}
			],
			"ts": 1630095821345,
			"event": {
				"content": {
					"body": "> <@elliria-5e77940ad73408ce4fdd9fb6:gitter.im> Hey there, everybody. There's an AutoKey behavior that has changed from version 0.09.4 to the current 0.95.10 and I'm not sure if it's a bug, an intentional fix, something interesting, something neutral, or something else entirely, so I figured I'd describe it here to see what you guys think and to find out if it should be filed as a bug. \n> \n> AutoKey 0.90.4 accepted ```---``` (three dashes) as an Abbreviation for a phrase or script.\n> \n> AutoKey 0.95.10 does not accept ```---``` (three dashes) as an Abbreviation unless you trick it. If you try to set that as the Abbreviation, AutoKey ignores your input entirely and does nothing. You can trick it by setting ```x---``` as the Abbreviation and, after it accepts it, editing the Abbreviation to remove the x. The three-dash Abbreviation then works without complaint.\n> \n> For the record, the environment for AutoKey 0.90.4 was Ubuntu MATE 16.04 LTS and the environment for AutoKey 0.95.10 was Kubuntu 20.04 LTS.\n> \n\nSounds like a bug to me, thank you. If possible could you file it as an issue? Otherwise I will if I get around to it",
					"format": "org.matrix.custom.html",
					"formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!dqBkUNHOHmuFWvsiHH:gitter.im/$iaWuRfG2-op9mfTSR9JN7Mw9QAgKHhRV-bU5T-VhMs8?via=kde.org&via=gitter.im&via=matrix.org\">In reply to</a> <a href=\"https://matrix.to/#/@elliria-5e77940ad73408ce4fdd9fb6:gitter.im\">@elliria-5e77940ad73408ce4fdd9fb6:gitter.im</a><br /><p>Hey there, everybody. There&#39;s an AutoKey behavior that has changed from version 0.09.4 to the current 0.95.10 and I&#39;m not sure if it&#39;s a bug, an intentional fix, something interesting, something neutral, or something else entirely, so I figured I&#39;d describe it here to see what you guys think and to find out if it should be filed as a bug. </p><p>AutoKey 0.90.4 accepted <code>---</code> (three dashes) as an Abbreviation for a phrase or script.</p><p>AutoKey 0.95.10 does not accept <code>---</code> (three dashes) as an Abbreviation unless you trick it. If you try to set that as the Abbreviation, AutoKey ignores your input entirely and does nothing. You can trick it by setting <code>x---</code> as the Abbreviation and, after it accepts it, editing the Abbreviation to remove the x. The three-dash Abbreviation then works without complaint.</p><p>For the record, the environment for AutoKey 0.90.4 was Ubuntu MATE 16.04 LTS and the environment for AutoKey 0.95.10 was Kubuntu 20.04 LTS.</p></blockquote></mx-reply>Sounds like a bug to me, thank you. If possible could you file it as an issue? Otherwise I will if I get around to it",
					"m.relates_to": {
						"m.in_reply_to": {
							"event_id": "$iaWuRfG2-op9mfTSR9JN7Mw9QAgKHhRV-bU5T-VhMs8"
						}
					},
					"msgtype": "m.text"
				},
				"origin_server_ts": 1630095820959,
				"sender": "@silico_biomancer:kde.org",
				"type": "m.room.message",
				"unsigned": {
					"age": 47006816101
				},
				"event_id": "$TWt_e4KX_Dh3wV2DOJ-6EEPQPkED60GqctgaklNQyM8"
			},
			"read": true
		},
		{
			"room_id": "!dqBkUNHOHmuFWvsiHH:gitter.im",
			"profile_tag": null,
			"actions": [
				"notify",
				{
					"set_tweak": "sound",
					"value": "default"
				},
				{
					"set_tweak": "highlight"
				}
			],
			"ts": 1626726000582,
			"event": {
				"content": {
					"body": "Awesome work Elliria (Elliria) !",
					"format": "org.matrix.custom.html",
					"formatted_body": "Awesome work <a href=\"https://matrix.to/#/@elliria-5e77940ad73408ce4fdd9fb6:gitter.im\">Elliria (Elliria)</a> !",
					"msgtype": "m.text"
				},
				"origin_server_ts": 1626726000231,
				"sender": "@silico_biomancer:kde.org",
				"type": "m.room.message",
				"unsigned": {
					"age": 50376636829
				},
				"event_id": "$6mzVma5MPa4HFHyb-WmbFzODikdgb_gHIvc30Q5_wmY"
			},
			"read": true
		},
		{
			"room_id": "!dqBkUNHOHmuFWvsiHH:gitter.im",
			"profile_tag": null,
			"actions": [
				"notify",
				{
					"set_tweak": "sound",
					"value": "default"
				},
				{
					"set_tweak": "highlight"
				}
			],
			"ts": 1624489549448,
			"event": {
				"content": {
					"body": "> <@elliria-5e77940ad73408ce4fdd9fb6:gitter.im> That's encouraging. At the moment, I have a few projects I have to get through before I can wear my official coder hat, but I'll continue playing around with code in general and poking around in the AutoKey sources just to see if anything jumps out at me.\n\nI recommend looking at tests as a starting point. They show you how code should work.\n(this is general advice more that for Autokey since our testing is a bit spotty)",
					"format": "org.matrix.custom.html",
					"formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!dqBkUNHOHmuFWvsiHH:gitter.im/$jZs3fG_Blnp7QxdCJ_QxhSYpjEUUTzVXE3mc5lsbB5Q?via=kde.org&via=gitter.im&via=matrix.org\">In reply to</a> <a href=\"https://matrix.to/#/@elliria-5e77940ad73408ce4fdd9fb6:gitter.im\">@elliria-5e77940ad73408ce4fdd9fb6:gitter.im</a><br />That&#39;s encouraging. At the moment, I have a few projects I have to get through before I can wear my official coder hat, but I&#39;ll continue playing around with code in general and poking around in the AutoKey sources just to see if anything jumps out at me.</blockquote></mx-reply>I recommend looking at tests as a starting point. They show you how code should work.<br />(this is general advice more that for Autokey since our testing is a bit spotty)",
					"m.relates_to": {
						"m.in_reply_to": {
							"event_id": "$jZs3fG_Blnp7QxdCJ_QxhSYpjEUUTzVXE3mc5lsbB5Q"
						}
					},
					"msgtype": "m.text"
				},
				"origin_server_ts": 1624489517264,
				"sender": "@silico_biomancer:kde.org",
				"type": "m.room.message",
				"unsigned": {
					"age": 52613119796
				},
				"event_id": "$yleRn95D6kE7gltkxObRzg2XPVi3aP2Hl8NN3Me9Ymo"
			},
			"read": true
		},
		{
			"room_id": "!dqBkUNHOHmuFWvsiHH:gitter.im",
			"profile_tag": null,
			"actions": [
				"notify",
				{
					"set_tweak": "sound",
					"value": "default"
				},
				{
					"set_tweak": "highlight"
				}
			],
			"ts": 1624414848819,
			"event": {
				"content": {
					"body": "> <@elliria-5e77940ad73408ce4fdd9fb6:gitter.im> Yep, it looks like that's where it is and... oof... that code is out of my league. I was hoping to see something simple and obvious that was wrong, but there are way too many references in there to things that could be the cause that I got all tangled up trying to follow them. Gotta stick with more basic code for now. All I can say is good luck. We're all counting on you.\n\nI also thought it would be simple, just adding/fixing a callback. But no, I think the issue is that callback for left click doesn't exist separate to right, or if it does it is documented poorly",
					"format": "org.matrix.custom.html",
					"formatted_body": "<mx-reply><blockquote><a href=\"https://matrix.to/#/!dqBkUNHOHmuFWvsiHH:gitter.im/$MD02yOZilNhT64gDFmop5AkQXzmdrHFZKDNp9xO1j_s?via=kde.org&via=gitter.im&via=matrix.org\">In reply to</a> <a href=\"https://matrix.to/#/@elliria-5e77940ad73408ce4fdd9fb6:gitter.im\">@elliria-5e77940ad73408ce4fdd9fb6:gitter.im</a><br />Yep, it looks like that&#39;s where it is and... oof... that code is out of my league. I was hoping to see something simple and obvious that was wrong, but there are way too many references in there to things that could be the cause that I got all tangled up trying to follow them. Gotta stick with more basic code for now. All I can say is good luck. We&#39;re all counting on you.</blockquote></mx-reply>I also thought it would be simple, just adding/fixing a callback. But no, I think the issue is that callback for left click doesn't exist separate to right, or if it does it is documented poorly",
					"m.relates_to": {
						"m.in_reply_to": {
							"event_id": "$MD02yOZilNhT64gDFmop5AkQXzmdrHFZKDNp9xO1j_s"
						}
					},
					"msgtype": "m.text"
				},
				"origin_server_ts": 1624414848530,
				"sender": "@silico_biomancer:kde.org",
				"type": "m.room.message",
				"unsigned": {
					"age": 52687788530
				},
				"event_id": "$kcf9okrQvjZyud6FHH8pDDN05_xlSxB49baxYYcv9U8"
			},
			"read": true
		}
	],
	"next_token": "6554474"
}

2: https://gitter.ems.host/_matrix/client/r0/notifications?limit=20&only=highlight&from=6554474

Response
{
	"notifications": [],
	"next_token": null
}

One aspect that could be playing a role is we had push.enable_push disabled for a little while during the Gitter import and then re-enabled it before everyone onboarded to the platform. Is this some stream position stuck problem for some users?

/notifications appears to work for me but we have reports from a couple of users that this isn't working (and as evidenced by their request/response above).

I've sent @elliria-5e77940ad73408ce4fdd9fb6:gitter.im direct mentions in a public, unencrypted room to doubly make sure this isn't some misunderstanding in how /notifications works (because it doesn't include encrypted events for example).

Affected users:

  • @elliria-5e77940ad73408ce4fdd9fb6:gitter.im
  • @josephj11-5a3f34bfd73408ce4f84a5df:gitter.im

Steps to reproduce

  1. Call /notifications?limit=20&only=highlight to get the latest events that mention you
  2. Notice stale results that don't include your latest mentions in a public unencrypted room.

Homeserver

gitter.im

Synapse Version

1.77.0

Installation Method

Docker (matrixdotorg/synapse)

Database

PostgreSQL

Workers

Multiple workers

Platform

EMS

Configuration

No response

Relevant log output

Do we actually log anything useful? The request log doesn't seem that helpful.

If you want to dive in, see the logs in Kibana from EMS

Anything else that would be useful to know?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-PushIssues related to push/notifications

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions