Synapse: Matrix homeserver written in Python/Twisted + Rust https://element-hq.github.io/synapse
  • Python 95.2%
  • Rust 3.5%
  • HTML 0.4%
  • Shell 0.3%
  • Go 0.2%
  • Other 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Junker der Provinz e5ac865661
Fix largest rooms Admin API failing when pg_stats has no common room IDs (#20390)
Fixes #19561

`GET /_synapse/admin/v1/statistics/database/rooms` returns a 500 when
`pg_stats` has no common `room_id` values for one of the tables it
checks. This happens in two cases:

- The table is empty or not yet analyzed, so `pg_stats` has no row for
it.
- No value is more common than the others, so `most_common_vals` is
`NULL`. `event_edges.room_id` hits this on servers where all rows were
written after schema 72 stopped filling the column.

The change skips the table in both cases, since it adds nothing to the
estimate.

Thanks to @christianarielli for finding the cause and suggesting the
fix. They're credited as co-author on the commit.

The new test runs only on Postgres, as the endpoint doesn't support
SQLite. It creates a room, runs `ANALYZE` while `event_push_actions` is
empty and `event_edges.room_id` is all `NULL`, and checks for a 200 with
the room listed. I ran it against Postgres 17.

`event_edges.room_id` isn't written any more, so dropping that table
from the list might make sense. I left that out to keep this PR small.

### Pull Request Checklist

<!-- Please read
https://element-hq.github.io/synapse/latest/development/contributing_guide.html
before submitting your pull request -->

* [x] Pull request is based on the develop branch
* [x] Pull request includes a [changelog
file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog).
The entry should:
- Be a short description of your change which makes sense to users.
"Fixed a bug that prevented receiving messages from other servers."
instead of "Moved X method from `EventStore` to `EventWorkerStore`.".
  - Use markdown where necessary, mostly for `code blocks`.
  - End with either a period (.) or an exclamation mark (!).
  - Start with a capital letter.
- Feel free to credit yourself, by adding a sentence "Contributed by
@github_username." or "Contributed by [Your Name]." to the end of the
entry.
* [x] [Code
style](https://element-hq.github.io/synapse/latest/code_style.html) is
correct (run the
[linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))

---------

Co-authored-by: Christian Arielli <903609+christianarielli@users.noreply.github.com>
Co-authored-by: Eric Eastwood <erice@element.io>
2026-11-13 13:57:50 +01:00
.ci Drop support for Python 3.10 (#20359) 2026-10-26 16:26:19 -05:00
.github Avoid using apt-key in CI as it was removed in Ubuntu 26.04 (#20511) 2026-11-12 11:10:11 +00:00
changelog.d Fix largest rooms Admin API failing when pg_stats has no common room IDs (#20390) 2026-11-13 13:57:50 +01:00
complement Bump go.opentelemetry.io/otel/sdk from 1.43.0 to 1.45.0 in /complement (#20236) 2026-10-16 10:43:40 +00:00
contrib Document how to capture a JSON snapshot of a Grafana dashboard (#20048) 2026-08-05 11:11:30 -05:00
debian 1.165.0 2026-11-10 13:28:59 -06:00
demo Profile endpoint rate limit (#20218) 2026-09-18 12:00:45 +01:00
docker Document that the MSC4143 transports endpoint can be run on a worker process (#20482) 2026-11-11 08:11:34 +00:00
docs Document that the MSC4143 transports endpoint can be run on a worker process (#20482) 2026-11-11 08:11:34 +00:00
rust Rate limiting, configurable TTL and correct auth responses for MSC4388 (sign-in with QR code) (#20404) 2026-11-05 15:00:12 +00:00
schema 1.165.0rc1 2026-11-04 14:18:37 -06:00
scripts-dev Add a metric for CPU time per thread type (#20405) 2026-11-09 10:30:04 +00:00
stubs Bump Twisted in poetry.lock from 25.5.0 to 26.4.0 (#20259) 2026-09-29 17:50:55 +00:00
synapse Fix largest rooms Admin API failing when pg_stats has no common room IDs (#20390) 2026-11-13 13:57:50 +01:00
synmark Port Clock functions to use Duration class (#19229) 2025-12-01 13:55:06 +00:00
tests Fix largest rooms Admin API failing when pg_stats has no common room IDs (#20390) 2026-11-13 13:57:50 +01:00
.codecov.yml
.coveragerc
.dockerignore Align comments in .dockerignore with synapse-private pro branch (#20224) 2026-09-17 10:09:17 -05:00
.editorconfig Apply correct editorconfig to .pyi files (#14526) 2022-11-22 18:33:28 +00:00
.git-blame-ignore-revs Ignore Python language refactors (.git-blame-ignore-revs) (#19150) 2025-11-10 22:34:30 +00:00
.gitignore Remove tox.ini (#20410) 2026-10-27 09:34:38 -05:00
.rustfmt.toml Prevent dirty Cargo.lock changes from install (#18693) 2025-07-18 10:28:10 -05:00
AUTHORS.rst
book.toml Bump mdbook from 0.4.17 -> 0.5.2 and remove custom table-of-contents plugin (#19356) 2026-01-07 18:46:03 +00:00
build_rust.py Drop support for Python 3.10 (#20359) 2026-10-26 16:26:19 -05:00
Cargo.lock Bump rustls from 0.23.45 to 0.23.46 (#20420) 2026-11-06 16:49:12 -06:00
Cargo.toml Fix building rust with nightly (#15906) 2023-07-10 16:24:04 +01:00
CHANGES.md Duplicate message about checking upgrade notes 2026-11-10 13:37:18 -06:00
CONTRIBUTING.md Update the contributing guide after reliecensing (#16772) 2024-01-03 11:31:03 +00:00
flake.lock Fix nix flake 2024-11-20 15:01:56 +00:00
flake.nix Use beautifulsoup4 instead of lxml for URL previews (#19301) 2026-10-02 15:46:34 +01:00
INSTALL.md Update book location 2023-12-13 16:15:22 +00:00
LICENSE-AGPL-3.0 make dual licensing explicit (#18134) 2025-02-05 13:40:10 +00:00
LICENSE-COMMERCIAL make dual licensing explicit (#18134) 2025-02-05 13:40:10 +00:00
mypy.ini Drop support for Python 3.10 (#20359) 2026-10-26 16:26:19 -05:00
poetry.lock Bump pyasn1 from 0.6.4 to 0.6.5 (#20462) 2026-11-09 17:19:32 +00:00
pyproject.toml 1.165.0 2026-11-10 13:28:59 -06:00
README.rst Fix a few readme links regarding ESS (#19070) 2026-09-24 09:58:57 +00:00
sytest-blacklist Default request token errors to privacy-preserving responses (#20243) 2026-10-09 13:26:31 +01:00
UPGRADE.rst Update book location 2023-12-13 16:15:22 +00:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.. image:: https://github.com/element-hq/synapse/raw/develop/docs/element_logo_white_bg.svg
   :height: 60px

**Element Synapse - Matrix homeserver implementation**

|support| |development| |documentation| |license| |pypi| |python|

Synapse is an open source `Matrix <https://matrix.org>`__ homeserver
implementation, written and maintained by `Element <https://element.io>`_.
`Matrix <https://github.com/matrix-org>`__ is the open standard for secure and
interoperable real-time communications. You can directly run and manage the
source code in this repository, available under an AGPL license (or
alternatively under a commercial license from Element).

There is no support provided by Element unless you have a subscription from
Element.

🚀 Getting started
==================

This component is developed and maintained by `Element <https://element.io>`_.
It gets shipped as part of the **Element Server Suite (ESS)** which provides the
official means of deployment.

ESS is a Matrix distribution from Element with focus on quality and ease of use.
It ships a full Matrix stack tailored to the respective use case.

There are three editions of ESS:

- `ESS Community <https://github.com/element-hq/ess-helm>`_ - the free Matrix
  distribution from Element tailored to small-/mid-scale, non-commercial
  community use cases
- `ESS Pro <https://element.io/server-suite>`_ - the commercial Matrix
  distribution from Element for professional use
- `ESS TI-M <https://element.io/server-suite/ti-messenger>`_ - a special version
  of ESS Pro focused on the requirements of TI-Messenger Pro and ePA as
  specified by the German National Digital Health Agency Gematik


🛠️ Standalone installation and configuration
============================================

The Synapse documentation describes `options for installing Synapse standalone
<https://element-hq.github.io/synapse/latest/setup/installation.html>`_. See
below for more useful documentation links.

- `Synapse configuration options <https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html>`_
- `Synapse configuration for federation <https://element-hq.github.io/synapse/latest/federate.html>`_
- `Using a reverse proxy with Synapse <https://element-hq.github.io/synapse/latest/reverse_proxy.html>`_
- `Upgrading Synapse <https://element-hq.github.io/synapse/develop/upgrade.html>`_


🎯 Troubleshooting and support
==============================

🚀 Professional support
-----------------------

Enterprise quality support for Synapse including SLAs is available as part of an
`Element Server Suite (ESS) <https://element.io/pricing>`_ subscription.

If you are an existing ESS subscriber then you can raise a `support request <https://customer.element.io/support>`_
and access the `Element product documentation <https://docs.element.io>`_.

🤝 Community support
--------------------

The `Admin FAQ <https://element-hq.github.io/synapse/latest/usage/administration/admin_faq.html>`_
includes tips on dealing with some common problems. For more details, see
`Synapse's wider documentation <https://element-hq.github.io/synapse/latest/>`_.

For additional support installing or managing Synapse, please ask in the community
support room |room|_ (from a matrix.org account if necessary). We do not use GitHub
issues for support requests, only for bug reports and feature requests.

.. |room| replace:: ``#synapse:matrix.org``
.. _room: https://matrix.to/#/#synapse:matrix.org

.. |docs| replace:: ``docs``
.. _docs: docs


🛠️ Development
==============

We welcome contributions to Synapse from the community!
The best place to get started is our
`guide for contributors <https://element-hq.github.io/synapse/latest/development/contributing_guide.html>`_.
This is part of our broader `documentation <https://element-hq.github.io/synapse/latest>`_, which includes
information for Synapse developers as well as Synapse administrators.

Developers might be particularly interested in:

* `Synapse's database schema <https://element-hq.github.io/synapse/latest/development/database_schema.html>`_,
* `notes on Synapse's implementation details <https://element-hq.github.io/synapse/latest/development/internal_documentation/index.html>`_, and
* `how we use git <https://element-hq.github.io/synapse/latest/development/git.html>`_.

Alongside all that, join our developer community on Matrix:
`#synapse-dev:matrix.org <https://matrix.to/#/#synapse-dev:matrix.org>`_, featuring real humans!

Copyright and Licensing
=======================

  | Copyright 2014–2017 OpenMarket Ltd
  | Copyright 2017 Vector Creations Ltd
  | Copyright 2017–2025 New Vector Ltd
  | Copyright 2025 Element Creations Ltd

This software is dual-licensed by Element Creations Ltd (Element). It can be
used either:

(1) for free under the terms of the GNU Affero General Public License (as
    published by the Free Software Foundation, either version 3 of the License,
    or (at your option) any later version); OR

(2) under the terms of a paid-for Element Commercial License agreement between
    you and Element (the terms of which may vary depending on what you and
    Element have agreed to).

Unless required by applicable law or agreed to in writing, software distributed
under the Licenses is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the Licenses for the
specific language governing permissions and limitations under the Licenses.

Please contact `licensing@element.io <mailto:licensing@element.io>`_ to purchase
an Element commercial license for this software.


.. |support| image:: https://img.shields.io/badge/matrix-community%20support-success
  :alt: (get community support in #synapse:matrix.org)
  :target: https://matrix.to/#/#synapse:matrix.org

.. |development| image:: https://img.shields.io/matrix/synapse-dev:matrix.org?label=development&logo=matrix
  :alt: (discuss development on #synapse-dev:matrix.org)
  :target: https://matrix.to/#/#synapse-dev:matrix.org

.. |documentation| image:: https://img.shields.io/badge/documentation-%E2%9C%93-success
  :alt: (Rendered documentation on GitHub Pages)
  :target: https://element-hq.github.io/synapse/latest/

.. |license| image:: https://img.shields.io/github/license/element-hq/synapse
  :alt: (check license in LICENSE file)
  :target: LICENSE

.. |pypi| image:: https://img.shields.io/pypi/v/matrix-synapse
  :alt: (latest version released on PyPi)
  :target: https://pypi.org/project/matrix-synapse

.. |python| image:: https://img.shields.io/pypi/pyversions/matrix-synapse
  :alt: (supported python versions)
  :target: https://pypi.org/project/matrix-synapse