Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was 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

@richvdh

Description

@richvdh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-Messages-Endpoint/messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill)A-PerformancePerformance, both client-facing and admin-facingT-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions