matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.79k stars 2.13k forks source link

Invites are not always included in sync #7406

Open schmop opened 4 years ago

schmop commented 4 years ago

Description

On fast changing membership states the sync will not reliably include rooms a user was invited to. It might be related to issues https://github.com/matrix-org/synapse/issues/4533 and https://github.com/matrix-org/synapse/issues/4422

Reproduction

This is not easily reproducable, an attempt should look as follows:

Version information

We used the synapse version v1.12.0. Installed per git clone And is operating in a debian stretch docker container.

Hotfix

A possibility to fix it temporarly is to restart the server or invalidate the caches.

We debugged this issue for quite some time and are using a hotfix, that stops caching from get_forgotten_rooms_for_user in roommember.py by removing following line: https://github.com/matrix-org/synapse/blob/9c1b83b0078aa9cc1bb902e14d3f7302625ba099/synapse/storage/data_stores/main/roommember.py#L797

alariej commented 4 years ago

It might even be a more general problem. Changes to an invite room do not seem to be included in any sync at all. For example in the case of a "direct" room, no syncs are pushed when the inviter changes display name or avatar, or leaves the room. I tested this with and without lazy_load_members filter parameter, with no difference.

Barry3D commented 3 years ago

I am currently running into this problem with synapse version v1.25.0.

It is easier to reproduce right now:

By looking into the database I found out that the data is received and persisted correctly, however the data in the following syncs only contain the state events for the user leaving the room.

I was also able to fix it via the change suggested in the original issue with slight adjustments since roommember.py has been moved and changed.