Skip to content

Federation sender memory leak in synapse 1.49.1 #19628

Description

@jkhsjdhjs

Description

When running synapse with federation sender workers, the workers start to use more and more memory over time, around 360MB per worker per day. I use 2 federation senders, so for me memory usage increased by 720MB per day. Eventually the LXC I'm running my synapse setup in reached its memory limit, memory pressure was applied, slowing down and stalling everything.

The following graph shows the memory usage of my synapse LXC. Restarts occured on 2026-03-07 and on 2026-03-15. Additionally, synapse was upgraded on the latter date, from 1.144.0 to 1.149.1.
The graph shows that with 1.144.0 memory usage was fairly stable, while it constantly increases with 1.149.1.
Graph depicting the LXCs usage

The following htop screenshot shows that the high memory usage is limited to the federation sender processes:
htop screenshot showing high memory usage of the federation sender processes

Steps to reproduce

Run synapse with federation senders

Homeserver

own homeserver running synapse 1.149.1

Synapse Version

1.149.1

Installation Method

Other (please mention below)

Database

PostgreSQL 18.3

Workers

Multiple workers

Platform

Arch Linux, LXC on Proxmox, Ryzen 5950X, LXC Limited to 20GiB of memory
Synapse installed via distro packages

Configuration

I'm using synapse with a main process and 3 workers. 1 generic_worker and 2 federation senders. Incoming requests are only handled by the generic_worker and main process based on static rules. No load balancing is done.

Furthermore, I'm using these experimental features:

experimental_features:
  # MSC3266: Room summary API. Used for knocking over federation
  msc3266_enabled: true
  # MSC4222 needed for syncv2 state_after. This allow clients to
  # correctly track the state of the room.
  msc4222_enabled: true

Relevant log output

Only error I see is

synapse.storage.databases.main.event_federation: [GET-3480033] Unexpectedly found that events don't have chain IDs in room !iMZEhwCvbfeAYUxAjZ:t2l.io: {'$ifBl2jg9HL3gG2y3mTDrlOwXzbEb3EcMRIH9hP6ghpM', '$IAIeX7zg7JGjy8KQASeYApVxmArz_54>

But I have been seeing this error before the upgrade to 1.149.1 as well. On 1.440.0 I didn't see any memory leak.

Anything else that would be useful to know?

@JacksonChen666 also experiences the same issue on 1.149.1.
1.150.0 is not available via my distributions packages yet, but the changelog also doesn't indicate any fixes regarding memory leaks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions