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

Synapse doesn't backfill missing events when rejoining a room later #15717

Open
sbug0 opened this issue Jun 5, 2023 · 5 comments
Open

Synapse doesn't backfill missing events when rejoining a room later #15717

sbug0 opened this issue Jun 5, 2023 · 5 comments
Labels
A-Federation A-Messages-Endpoint /messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill) O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@sbug0
Copy link

sbug0 commented Jun 5, 2023

Description

If I'm the only user from my home server in a room (with more users from other severs),
stays there for a while and get's a lot of events,
then leave the room,
then rejoins the room a few days later,
I'm missing the events in the room between the point where I left the room up to the point I rejoined the room.

Synapse does not backfill those events.

Steps to reproduce

  • As the only user from your home server, join a room with other servers
  • Stay in the room for a while to get events in the room ( like messages, joins etc)
  • Leave the room for a while (so long as to there being new events in the room)
  • Rejoin the room
  • See that the missing events doesn't get backfilled

You will see something like this:

  • you joining the room
  • messages
  • messages
  • messages
  • you leaving the room

missing events you will not see

I have reported this before years ago but I shut down that server before Matrix team started to investigate, and when they looked at the bug they closed it because I wasn't active any more. So this is an old bug and not something newly introduced.

Homeserver

sinnesro.se

Synapse Version

{"server_version":"1.84.1","python_version":"3.9.2"}

Installation Method

Debian packages from packages.matrix.org

Database

Single PostgreSQL, never used SQLite, never restored from backup

Workers

Single process

Platform

Debian 11 latest updated
Running in an LXD

Intel Core i5 12th gen, 16 GB RAM, 256 GB SSD

Configuration

No response

Relevant log output

I have included my home server logs earlier in the bug report because I don't know what is relevant to show here.

Anything else that would be useful to know?

No response

@erikjohnston
Copy link
Member

Hi @sbug0, can I confirm the room you joined in the logs is !eAoSQVNgWAxwNNJvrX:matrix.org?

Judging from the logs it looks like the client didn't even try to paginate. Am I right in thinking after you join the room a second time on the client you see something like (from old to new messages):

  • old message
  • old message
  • leave
  • join
  • new message

And there should be messages between the leave and join?

If so, then I think this is a bug where we incorrectly send down the older events in the /sync response after joining the room. This would cause clients to only paginate backwards from the old messages, and so the server would never realise it needed to fetch the events in the gap (because the client never explicitly asked for it).

@sbug0
Copy link
Author

sbug0 commented Jun 6, 2023

Hi.

Yes, that is the room in question.

And yes, that's what I'm seeing in my client. (Doesn't matter which client, or if I start a new fresh client).

And yes, there should be messages between my leave and join. (As seen from a client I have on another server in that room).

@erikjohnston erikjohnston added S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. O-Occasional Affects or can be seen by some users regularly or most users rarely A-Federation labels Jun 6, 2023
@erikjohnston
Copy link
Member

Thanks @sbug0

I think we need to add a condition in this loop:

while limited and len(recents) < timeline_limit and max_repeat:

to ensure that we don't send down events from before the gap... somehow

@MadLittleMods MadLittleMods added the A-Messages-Endpoint /messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill) label Jun 15, 2023
@MadLittleMods
Copy link
Contributor

One alternative is to use MSC3871: Gappy timelines to indicate the gap so clients can retry fetching in the place with missing history.

@rom4nik
Copy link

rom4nik commented Sep 26, 2023

FTR, previous occurence of this issue with a few more reports: #8936

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Federation A-Messages-Endpoint /messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill) O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

4 participants