This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Pagination in a large room with restricted visibility can cause an OOM #12523
Labels
A-Messages-Endpoint
/messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill)
A-Performance
Performance, both client-facing and admin-facing
T-Defect
Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Consider a large room (thousands of members) with thousands of backward extremities.
A client makes a
/messages
request, which triggers us to consider whether to backfill from a remote server.This leads to this bit of code, where we look at each of the backwards extremities and decide if they are likely to be visible to any of our users. (Actually, it's worse - we look at each of the successors of the backwards extremities, which can increase the number of events by an order of magnitude.) For each event we consider in this way, we end up pulling the event ids for the entire room state at that event into memory. (We don't actually pull the events themselves, unless they are membership events for our local server).
We can easily end up trying to hold tens of millions of event ids in memory at once for this. It completely blows the
*stateGroupMembersCache*
, and leads to an OOM after a minute or two.The text was updated successfully, but these errors were encountered: