This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Fix bug which caused rejected events to be stored with the wrong room state #6320
Merged
Fix bug which caused rejected events to be stored with the wrong room state #6320
Conversation
73cd3c2 to
a80143f
Compare
erikjohnston
approved these changes
Nov 5, 2019
Member
|
Do we have any unit tests for |
Member
Author
there are a bunch in https://github.com/matrix-org/synapse/blob/develop/tests/test_state.py. I guess I know where that question is leading... |
Member
Just adding some checks for the new fields in those tests would be good 😇 |
Fixes a bug where rejected events were persisted with the wrong state group. Also fixes an occasional internal-server-error when receiving events over federation which are rejected and (possibly because they are backwards-extremities) have no prev_group. Fixes #6289.
37ec6ee to
ba3a5e8
Compare
Member
Author
|
tests (and a lying docstring) updated in ba3a5e8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem here was the code in
StateStorewhich assumed thatprev_groupgave the state before the event being persisted. Whilst this may (sometimes) have been true for state events, it was never true for message events.I'm not entirely sure if this is the best way to fix it, but the general idea is to rewrite
compute_event_contextto ensure that we always have a state group for the state before the event being persisted (and to store it in a new field in theEventContext). That also allows us to rewrite it to reduce a bunch of duplication between the code paths.Fixes #6289.
This PR builds on #6319.