bug: Extremities referenced by soft-failed/rejected events are never culled until trailed by a dummy event #2123
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
bob the builder
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity#2123
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rejected and soft-failed events do not count towards referencing, per the spec, however this means servers can incorrectly build up an extremity list of events that have actually been referenced. For example:
A -> B -> C -> DIn this case, if
Bsoft-fails on only some servers, bothAandDwill become forward extremities, despiteBbeing indirectly referenced viaB <- C <- D. However, on serversBdid not soft-fail on, it will not be a forward extremity, and onlyDwill correctly be.The result of this is servers are incorrectly building up extremities that are not actually extremities due to a circumstantial view of the room. These extremities are then only culled when enough are built up for the server to start a squash, which might then mean the server references events from ages ago, which can even cause state resets.
Related: #2016 can exacerbate this issue by erroneously rejecting memberships and consequently every subsequent event depending on those memberships
Technically speaking, soft-fails SHOULD affect references (whereas rejections never do), but soft-failed events cannot themselves become extremities. This is a problem, because historically we did this correctly, but that caused the extremity table to organically drain itself. And when there's no extremities, you can't create new events.
A possible solution here is to do a topological walk of extremities to determine which ones are actually reachable in the tree even through soft-failed events, but this would be expensive, and would probably be best performed before starting a squash process. That's still uncomfortable though as we default to allowing 10 extremities to build up before considering a squash
A potential fix for soft-fails specifically is
nex/continuwuity@59ebd1719b. Rejections will be harder, so see above I guess