-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Exclude OOB memberships from the federation sender #12570
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix a bug introduced in Synapse 1.57 which could cause `Failed to calculate hosts in room` errors to be logged for outbound federation. | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -355,6 +355,39 @@ async def handle_event(event: EventBase) -> None: | |||||||||||||||||||||
| if not is_mine and send_on_behalf_of is None: | ||||||||||||||||||||||
| return | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # We also want to not send out-of-band membership events. | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is The 3.5 cases below seem to enumerate them and explain why we don't want to send them out. It might be useful to have this list of 3.5 event types here (a more authoritative place?): synapse/synapse/events/__init__.py Lines 214 to 223 in c027bc0
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
https://matrix-org.github.io/synapse/develop/development/room-dag-concepts.html#out-of-band-membership-events has some info on it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The 3.5 cases here are intended as a proof by enumeration that it's correct to drop these events in the federation sender, rather than acting as an authoritative list of what OOB memberships are. The authoritative source for compiling this list was searching the codebase for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, that makes sense. Perhaps just the introductory sentence from https://matrix-org.github.io/synapse/develop/development/room-dag-concepts.html#out-of-band-membership-events
would help illuminate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've updated the docstring for |
||||||||||||||||||||||
| # | ||||||||||||||||||||||
| # OOB memberships are used in three (and a half) situations: | ||||||||||||||||||||||
| # | ||||||||||||||||||||||
| # (1) invite events which we have received over federation. Those | ||||||||||||||||||||||
| # will have a `sender` on a different server, so will be | ||||||||||||||||||||||
| # skipped by the "is_mine" test above anyway. | ||||||||||||||||||||||
| # | ||||||||||||||||||||||
| # (2) rejections of invites to federated rooms. These are normally | ||||||||||||||||||||||
| # created via federation (in which case the remote server is | ||||||||||||||||||||||
| # responsible for sending out the rejection). If that fails, | ||||||||||||||||||||||
| # we'll create a leave event locally, but that's only really | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And it's this local fallback event that is considered out-of-band? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, both the federated and local cases are out-of-band. Any thoughts on how I can reword this paragraph to make this clear? How about: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the rework. But the underlying difficulty I'm having here is that I don't grok the meaning of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is maybe not the best term (see #4405 (review), which is where we expanded the idea beyond case (1).) It's "out of band" inasmuch as it's not sent over the regular There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are only two hard problems, after all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've updated the wording here in ca5b502. |
||||||||||||||||||||||
| # for the benefit of the invited user - we don't have enough | ||||||||||||||||||||||
| # information to send it out over federation. | ||||||||||||||||||||||
| # | ||||||||||||||||||||||
| # (2a) rescinded knocks. These are identical to rejected invites. | ||||||||||||||||||||||
| # | ||||||||||||||||||||||
| # (3) knock events which we have sent over federation. As with | ||||||||||||||||||||||
| # invite rejections, the remote server should send them out to | ||||||||||||||||||||||
| # the federation. | ||||||||||||||||||||||
DMRobertson marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
| # | ||||||||||||||||||||||
| # So, in all the above cases, we want to ignore such events. | ||||||||||||||||||||||
| # | ||||||||||||||||||||||
| # OOB memberships are always(?) outliers anyway, so if we *don't* | ||||||||||||||||||||||
| # ignore them, we'll get an exception further down when we try to | ||||||||||||||||||||||
| # fetch the membership list for the room. | ||||||||||||||||||||||
| # | ||||||||||||||||||||||
| if event.internal_metadata.is_out_of_band_membership(): | ||||||||||||||||||||||
| return | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Finally, there are some other events that we should not send out | ||||||||||||||||||||||
| # until someone asks for them. They are explicitly flagged as such | ||||||||||||||||||||||
| # with `proactively_send: False`. | ||||||||||||||||||||||
| if not event.internal_metadata.should_proactively_send(): | ||||||||||||||||||||||
| return | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.