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

Adding rooms to a space is rate limited providing a poor user experience #9917

Open
clokep opened this issue Apr 30, 2021 · 6 comments
Open
Labels
A-Spaces Hierarchical organization of rooms 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 Apr 30, 2021

It is possible to add many rooms to a space in one-go, unfortunately Synapse will rate limit this sometimes causing a poor user experience. This is particularly bad when creating "just me" rooms where the user might want to add a high number of rooms at once.

See element-hq/element-web#16891.

image

@clokep clokep added the A-Spaces Hierarchical organization of rooms label Apr 30, 2021
@clokep
Copy link
Member Author

clokep commented Apr 30, 2021

To clarify -- this is not about rate limiting joining of rooms, but seems to be about adding (state) events to a room.

@clokep
Copy link
Member Author

clokep commented Apr 30, 2021

I think a proposal of what could be done is to allow a room admin a higher rate limit for adding space events (m.space.child and m.space.parent) to a room than the standard rate limit, which defaults to 10.

Seems like this will touch some of the rate limiting code for messages:

if ratelimit:
# We check if this is a room admin redacting an event so that we
# can apply different ratelimiting. We do this by simply checking
# it's not a self-redaction (to avoid having to look up whether the
# user is actually admin or not).
is_admin_redaction = False
if event.type == EventTypes.Redaction:
original_event = await self.store.get_event(
event.redacts,
redact_behaviour=EventRedactBehaviour.AS_IS,
get_prev_content=False,
allow_rejected=False,
allow_none=True,
)
is_admin_redaction = bool(
original_event and event.sender != original_event.sender
)
await self.base_handler.ratelimit(
requester, is_admin_redaction=is_admin_redaction
)

@ara4n
Copy link
Member

ara4n commented Apr 30, 2021

alternatively, should we consider a batch API? trickling events at any rate from the client sounds a bit flimsy.

@clokep
Copy link
Member Author

clokep commented May 4, 2021

alternatively, should we consider a batch API? trickling events at any rate from the client sounds a bit flimsy.

That's a good thought. I wonder if we have any bulk endpoints already and if we rate limit per endpoint call or per message that way...

@clokep
Copy link
Member Author

clokep commented May 4, 2021

It seems both room create (and upgrade room) kind of do this. Implementation-wise they have a custom ratelimiter instead of the normal event ratelimiter, so this isn't fully without precedence. I guess we would have to consider if it was specific to spaces or a generic "dump a bunch of state into a room" endpoint.

@clokep
Copy link
Member Author

clokep commented May 12, 2021

I put together an MSC for batch state updates: matrix-org/matrix-spec-proposals#3192 which I hope would meet the needs of this.

@erikjohnston erikjohnston added S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Spaces Hierarchical organization of rooms 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

3 participants