v9 rooms are unusable when a Dendrite user is invited
Background information
- Dendrite version or git SHA: 0.8.1+07397264
- Monolith or Polylith?: Monolith
- SQLite3 or Postgres?: Postgres
- Running in Docker?: No
go version: go1.18.1 linux/arm64- Client used (if applicable): N/A
Description
- What is the problem: When inviting a user to a direct chat, Dendrite states that the created room is v9, which is unstable. It offers to upgrade the room to v6. Additionally, an error is generated in the logs (see below).
- Who is affected: Dendrite users who are invited by a Matrix home server where the default room is v9, e.g. Synapse 1.55.2.
- How is this bug manifesting: When a client using Synapse, or possibly any other home server with a v9 room by default invites a user who uses Dendrite. The issue does not happen the other way around, i.e. if a Dendrite server sends an invite to a Synapse server.
- When did this first appear: Not sure, as I've recently switched from Synapse.
Steps to reproduce
- Using a home server where v9 rooms are the default, e.g. Synapse 1.55.2, via Element and possibly others, invite a client that uses a Dendrite server.
- Upon accepting the invite, a room will be created. The Dendrite server user will get a room upgrade offer.
Log Entry
Apr 19 16:45:05 ashildr dendrite-monolith-server[96805]: time="2022-04-19T14:45:05.126074018Z" level=error msg="d.addRoomDeltaToResponse failed" device_id=_bAER4XW error="sql: no rows in result set" limit=20 req.id=c4oGKOTWu7e2 req.method=GET req.path=/_matrix/client/r0/sync since=s134_215_49_49_169_168_24_2_140 timeout=30s user_id="@user:matrix.example.com"
This might be loosely related to https://github.com/matrix-org/dendrite/issues/2010
It happens in Dendrite 0.8.1+d0666902 (go1.18.1 windows/amd64) too
Are you suggesting that the only possibility here is to upgrade the room and not to continue using it despite the unstable flag?
Are you suggesting that the only possibility here is to upgrade the room and not to continue using it despite the unstable flag?
According to my tests, when this issue happens, a client connected to the Dendrite server immediately leaves the room, occasionally followed by the Synapse user. Using a v9 room in this scenario is not possible without upgrading it first. The link to the upgraded room (at least through Element) is not sent to the other party, however, inviting the same Synapse server user to the upgraded room works.
I'm more concerned about the SQL error when sending a sync request (though maybe I shouldn't be), but ultimately, it would be nice to find a solution for this so that v9 rooms could be used without upgrading.
Not entirely sure if matching under this bug, but I observe similar behaviour when a user from matrix.org tries starts a new chat (person to person). The room fails to establish and after Rejecting it, I see the following message:

I'm also attaching a snippet from my log files that show what happens while the session is initialized:
I just want to be clear that we aren't confusing the words unstable and unusable here?
Room versions 8 and 9 are marked as unstable but they should still be usable — you should effectively be able to ignore the red warning and continue using the room as normal, although there might still be bugs.
I have been working more on the support over the last couple of days so hopefully I'll be able to mark it stable soon.
Thanks for looking into this @neilalexander. I'm closely monitoring the commit logs since I switched to Dendrite, but it's great to see this confirmed here as well.
Unfortunately, v9 rooms are indeed unusable on my end in the scenario I described above, see the quote from a previous message I posted:
According to my tests, when this issue happens, a client connected to the Dendrite server immediately leaves the room, occasionally followed by the Synapse user. Using a v9 room in this scenario is not possible without upgrading it first. The link to the upgraded room (at least through Element) is not sent to the other party, however, inviting the same Synapse server user to the upgraded room works.
To further elaborate: I am seeing a user leave event via Element and messages I send are not seen by the other user, the only solution is to invite the Synapse user to a v6 room.
Testing via b541f3043f0ad8924547c540d9235d017d1792f6, joining a v9 room is now working as expected, although I see a leave and a join event via Element for myself in the chat history, right after accepting the invite. I'm mentioning it in case this is not supposed to happen.
I am also getting an error in the logs during the first sync, which happens right after Joined federated room with hosts:
May 27 09:51:49 ashildr dendrite-monolith-server[47301]: time="2022-05-27T07:51:49.077725147Z" level=error msg="internal.DeviceListCatchup failed" device_id=XXX error="GetBulkStateContent: failed to load state for room !XXX:matrix.org : storage: state NIDs missing from the database (0 != 1)" limit=20 req.id=SMqZw7vGfjsc req.method=GET req.path=/_matrix/client/r0/sync since=s7687_2_477_2312_7688_7690_175_340_9706 timeout=30s user_id="@user:matrix_example.com"
Testing via b541f30, joining a v9 room is now working as expected, although I see a leave and a join event via Element for myself in the chat history, right after accepting the invite. I'm mentioning it in case this is not supposed to happen.
This should be fixed with #2817. As the original issue seems to be fixed, I'm going to close this now. (If not, feel free to re-open)