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

KeyError in generate_room_entry #9330

Open
clokep opened this issue Feb 5, 2021 · 1 comment
Open

KeyError in generate_room_entry #9330

clokep opened this issue Feb 5, 2021 · 1 comment
Labels
A-Background-Updates Filling in database columns, making the database eventually up-to-date S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@clokep
Copy link
Member

clokep commented Feb 5, 2021

See https://sentry.matrix.org/sentry/synapse-matrixorg/issues/196208/ for background.

This code is breaking because the current state doesn't include a m.room.create event:

# Return whether this room is open to federation users or not
create_event = current_state[EventTypes.Create, ""]
result["m.federate"] = create_event.content.get("m.federate", True)

Looking in the database a the room it does include a create event, but only in the events table, not the current_state_events (which is made up purely of membership events). It seems there might be a bug here that server left the room but didn't properly clean-up the current state events.

Some conversation around this: https://matrix.to/#/!XaqDhxuTIlvldquJaV:matrix.org/$dLy7NInKFWgQW5zeIfxlEjPHvCGWOuxNV1WhpRy6Epk?via=matrix.org&via=vector.modular.im&via=maunium.net

@clokep clokep added S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Feb 5, 2021
@clokep
Copy link
Member Author

clokep commented Feb 5, 2021

According to @erikjohnston:

I thought we had a BG update to delete entries in current state evnets if the server had left

It seems this is the delete_old_current_state_events update, maybe there's a bug in that method:

async def _background_remove_left_rooms(self, progress, batch_size):
"""Background update to delete rows from `current_state_events` and
`event_forward_extremities` tables of rooms that the server is no
longer joined to.
"""

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Background-Updates Filling in database columns, making the database eventually up-to-date S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

2 participants