matrix-org / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://matrix-org.github.io/dendrite/
Apache License 2.0
5.75k stars 674 forks source link

Spaces Summary not working properly over federation #2504

Closed boogewooge closed 7 months ago

boogewooge commented 2 years ago

Background information

Description

Steps to reproduce

  1. Create a space on a dendrite instance and add public rooms to it.
  2. Invite a user on a synapse instance to the space and optionally one of the rooms in the space
  3. The synapse-based user will only be able to see any rooms they're already in in the space summary, instead of all (public) rooms in it.
bones-was-here commented 2 years ago

I also consistently see this issue on 2 instances of 0.8.6, I think it has existed for as long as spaces summary has been working.

When a dendrite has no users in a room it tries to get summary information from the other dendrite (the one that owns the namespace and is still in the room) which fails with a similar error to the synapse one above:
level=warning msg="failed to call MSC2946Spaces on server xa.org.au" error="contents=[123 34 101 114 114 99 111 100 101 34 58 34 77 95 78 79 84 95 70 79 85 78 68 34 44 34 101 114 114 111 114 34 58 34 114 111 111 109 32 105 115 32 117 110 107 110 111 119 110 47 102 111 114 98 105 100 100 101 110 34 125] msg=Failed to GET JSON (hostname \"xa.org.au\" path \"/_matrix/federation/unstable/org.matrix.msc2946/hierarchy/!T1Q7bEvMDxbyvRDm:xa.org.au\") code=404 wrapped=M_NOT_FOUND: room is unknown/forbidden" req.id=oAFi4cqBYh6y req.method=GET req.path="/_matrix/client/v1/rooms/!P0hFeHphHR4Wmpkn:xa.org.au/hierarchy" user_id="@bones_was_here:xonotic.org"

bones-was-here commented 2 years ago

Here's a workaround for (only) the case of a remote homeserver joining a space while not already participating in the room(s) listed in that space.
If the "via": [] array in a m.space.child event lists only Dendrite homeserver(s) (regardless of whether those Dendrites are participating in the space or the room the event points to), the user(s) of the remote homeserver will not see that room in the space summary.
If a Synapse homeserver which is already participating is added to the "via": [] array, then the user(s) of the remote homeserver will see that room in the space summary (even if the remote homeserver is a Dendrite).

It's not ideal because it can be quite slow (if the Dendrite is tried first and then the Synapse? or maybe it's just slow because I used matrix.org) but it's better than people seeing a blank room list when they're the first person to join from their homeserver.

This also may explain why some people have not been able to reproduce the issue: they have a Synapse listed in their m.space.child event(s).

bones-was-here commented 2 years ago

This appears to have been fixed by #2578 in 0.9.2

ashkitten commented 2 years ago

still seeing this on 0.9.3 with "join_rule": "restricted"

edit: added a public room to the space, remote server (synapse) still cannot see the room in the space without joining it. adding a different remote server that's in the room to the "via" array fixes visibility.

viviicat commented 1 year ago

I believe this is still happening in v0.12. Still getting the same message in the logs.