Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Faster joins: handle state which becomes invalid during de-partial-stating #13006

Closed
richvdh opened this issue Jun 9, 2022 · 0 comments · Fixed by #13459
Closed

Faster joins: handle state which becomes invalid during de-partial-stating #13006

richvdh opened this issue Jun 9, 2022 · 0 comments · Fixed by #13459
Assignees
Labels
A-Federated-Join joins over federation generally suck T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@richvdh
Copy link
Member

richvdh commented Jun 9, 2022

It's entirely possible that, during the process of de-partial-stating, we discover that we accepted some piece of state which we should not have done. (Simple example: it may turn out that the sender of a piece of state was not actually in the room at the time). We may have told clients about that state, and we may even have made other event-auth or access decisions based on it.

(I think this is also possible for backfilled events even in the non-faster-joins case, though a bit less likely.)

We should figure out the ramifications of that, and do something about it.

def must_await_full_state(self, is_mine_id: Callable[[str], bool]) -> bool:
"""Check if we need to wait for full state to complete to calculate this state
If we have a state filter which is completely satisfied even with partial
state, then we don't need to await_full_state before we can return it.
Args:
is_mine_id: a callable which confirms if a given state_key matches a mxid
of a local user
"""
# TODO(faster_joins): it's not entirely clear that this is safe. In particular,
# there may be circumstances in which we return a piece of state that, once we
# resync the state, we discover is invalid. For example: if it turns out that
# the sender of a piece of state wasn't actually in the room, then clearly that
# state shouldn't have been returned.
# We should at least add some tests around this to see what happens.
# https://github.com/matrix-org/synapse/issues/13006

@richvdh richvdh added A-Federated-Join joins over federation generally suck T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Jun 9, 2022
@richvdh richvdh added this to the Faster joins (further work) milestone Jun 9, 2022
@richvdh richvdh self-assigned this Jul 22, 2022
@richvdh richvdh linked a pull request Aug 5, 2022 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Federated-Join joins over federation generally suck T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant