element-hq / element-hq/synapse
Sending many events in parallel creates forward extremities instead of linearizing creation
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
### Description
When sending many events in parallel, Synapse doesn't linearize the event persistence properly, leading to the creation of forward extremities.
I think this is a regression because I recall linearization being fixed years ago, but I don't remember the exact details of the previous fix and couldn't find any obvious problems by scanning recent commits.
### Steps to reproduce
- send multiple events to a single room in parallel (using the standard `/_matrix/client/v3/rooms/.../send/m.room.message/txnid` endpoint, on a single server with a single account)
- observe rows in the `event_forward_extremities` table for the room and the `prev_events` for each created event
Expected result: there is one forward extremity (the last event) and each event references the previous one
Actual result: each event sent in parallel is listed as a forward extremity, and they all reference the same prev event
### Homeserver
maunium.net, localhost, rory.gay, codestorm.net
### Synapse Version
1.129.0
### Database
Tested with PostgreSQL v17 and v14
### Workers
Reproducible with any configuration (single process, one event stream worker, multiple event stream workers)
---
Keywords: DAG self-fork
Contributor guide
Assessment
This issue has not been assessed yet.