element-hq / element-hq/synapse
GET /rooms/xxxx/members returns outdated information
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
### Description
Looking at a UTD rageshake, the symptoms are that a user creates a DM in Element Web and sends a message (in Element Web, the DM room is not actually created until the user sends an initial message, so the room creation and message sending are done in short succession). The other user joins the DM later, and is unable to read the message.
Looking at the rageshake logs, the user calls `POST /createRoom` (which would include inviting the other user). A bit later, they call `GET /rooms/xxxx/members` to find out who to encrypt to. However, `GET /rooms/xxxx/members` only returns 1 user (themselves), and so they don't encrypt to the other user who was invited.
The relevant rageshake logs lines (sanitized):
```
xxxxT15:52:04.189Z D FetchHttpApi: --> POST https://matrix-client.matrix.org/_matrix/client/v3/createRoom
xxxxT15:52:06.470Z D FetchHttpApi: <-- POST https://matrix-client.matrix.org/_matrix/client/v3/createRoom [2281ms 200]
xxxxT15:52:06.712Z D FetchHttpApi: --> GET https://matrix-client.matrix.org/_matrix/client/v3/rooms/xxxx/members?not_membership=xxx&at=xxx
xxxxT15:52:08.069Z D FetchHttpApi: <-- GET https://matrix-client.matrix.org/_matrix/client/v3/rooms/xxxx/members?not_membership=xxx&at=xxx [1357ms 200]
xxxxT15:52:08.070Z D LL: got 1 members from server for room xxxx
xxxxT15:52:08.070Z D LL: RoomState about to set 1 OOB members ...
xxxxT15:52:08.070Z D LL: RoomState put in finished state ...
xxxxT15:52:08.070Z D LL: telling store to write 0 members for room xxxx
```
This was for a matrix.org user, so could be an issue with workers.
### Steps to reproduce
- Create a DM in Element Web and send a message
### Homeserver
matrix.org
### Synapse Version
currently reported as 1.124.0rc2 (b=matrix-org-hotfixes,fed913aef1) -- I don't know what version it was on when the bug was encountered
### Installation Method
I don't know
### Database
PostgreSQL
### Workers
Multiple workers
### Platform
don't know
### Configuration
_No response_
### Relevant log output
```shell
I don't have access to the server logs.
```
### Anything else that would be useful to know?
_No response_
Contributor guide
Research direction
Start by tracing the Synapse handler for GET /rooms/{room_id}/members and the worker-related path following POST /createRoom. Reproduce the DM sequence with multiple workers and PostgreSQL, then verify that the invited member appears in the membership response and is available for encryption.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100