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

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into hs/hacked-together…
Browse files Browse the repository at this point in the history
…-event-cache
  • Loading branch information
Half-Shot committed May 11, 2021
2 parents 6a20b4f + 63fb220 commit dacc395
Show file tree
Hide file tree
Showing 364 changed files with 1,599 additions and 399 deletions.
36 changes: 0 additions & 36 deletions .buildkite/scripts/create_postgres_db.py

This file was deleted.

31 changes: 31 additions & 0 deletions .buildkite/scripts/postgres_exec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import psycopg2

# a very simple replacment for `psql`, to make up for the lack of the postgres client
# libraries in the synapse docker image.

# We use "postgres" as a database because it's bound to exist and the "synapse" one
# doesn't exist yet.
db_conn = psycopg2.connect(
user="postgres", host="postgres", password="postgres", dbname="postgres"
)
db_conn.autocommit = True
cur = db_conn.cursor()
for c in sys.argv[1:]:
cur.execute(c)
35 changes: 26 additions & 9 deletions .buildkite/scripts/test_synapse_port_db.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
#
# Test script for 'synapse_port_db', which creates a virtualenv, installs Synapse along
# with additional dependencies needed for the test (such as coverage or the PostgreSQL
# driver), update the schema of the test SQLite database and run background updates on it,
# create an empty test database in PostgreSQL, then run the 'synapse_port_db' script to
# test porting the SQLite database to the PostgreSQL database (with coverage).
# Test script for 'synapse_port_db'.
# - sets up synapse and deps
# - runs the port script on a prepopulated test sqlite db
# - also runs it against an new sqlite db


set -xe
cd `dirname $0`/../..
Expand All @@ -22,15 +22,32 @@ echo "--- Generate the signing key"
# Generate the server's signing key.
python -m synapse.app.homeserver --generate-keys -c .buildkite/sqlite-config.yaml

echo "--- Prepare the databases"
echo "--- Prepare test database"

# Make sure the SQLite3 database is using the latest schema and has no pending background update.
scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml

# Create the PostgreSQL database.
./.buildkite/scripts/create_postgres_db.py
./.buildkite/scripts/postgres_exec.py "CREATE DATABASE synapse"

echo "+++ Run synapse_port_db against test database"
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml

#####

# Now do the same again, on an empty database.

echo "--- Prepare empty SQLite database"

# we do this by deleting the sqlite db, and then doing the same again.
rm .buildkite/test_db.db

scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml

echo "+++ Run synapse_port_db"
# re-create the PostgreSQL database.
./.buildkite/scripts/postgres_exec.py \
"DROP DATABASE synapse" \
"CREATE DATABASE synapse"

# Run the script
echo "+++ Run synapse_port_db against empty database"
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Patch Buildkite-specific test scripts
run: |
sed -i -e 's/host="postgres"/host="localhost"/' .buildkite/scripts/create_postgres_db.py
sed -i -e 's/host="postgres"/host="localhost"/' .buildkite/scripts/postgres_exec.py
sed -i -e 's/host: postgres/host: localhost/' .buildkite/postgres-config.yaml
sed -i -e 's|/src/||' .buildkite/{sqlite,postgres}-config.yaml
sed -i -e 's/\$TOP/\$GITHUB_WORKSPACE/' .coveragerc
Expand Down
25 changes: 25 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
Synapse 1.33.2 (2021-05-11)
===========================

Due to the security issue highlighted below, server administrators are encouraged to update Synapse. We are not aware of these vulnerabilities being exploited in the wild.

Security advisory
-----------------

This release fixes a denial of service attack ([CVE-2021-29471](https://github.com/matrix-org/synapse/security/advisories/GHSA-x345-32rc-8h85)) against Synapse's push rules implementation. Server admins are encouraged to upgrade.

Internal Changes
----------------

- Unpin attrs dependency. ([\#9946](https://github.com/matrix-org/synapse/issues/9946))


Synapse 1.33.1 (2021-05-06)
===========================

Bugfixes
--------

- Fix bug where `/sync` would break if using the latest version of `attrs` dependency, by pinning to a previous version. ([\#9937](https://github.com/matrix-org/synapse/issues/9937))


Synapse 1.33.0 (2021-05-05)
===========================

Expand Down
29 changes: 29 additions & 0 deletions UPGRADE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,35 @@ for example:
wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
Upgrading to v1.34.0
====================

`room_invite_state_types` configuration setting
-----------------------------------------------

The ``room_invite_state_types`` configuration setting has been deprecated and
replaced with ``room_prejoin_state``. See the `sample configuration file <https://github.com/matrix-org/synapse/blob/v1.34.0/docs/sample_config.yaml#L1515>`_.

If you have set ``room_invite_state_types`` to the default value you should simply
remove it from your configuration file. The default value used to be:

.. code:: yaml
room_invite_state_types:
- "m.room.join_rules"
- "m.room.canonical_alias"
- "m.room.avatar"
- "m.room.encryption"
- "m.room.name"
If you have customised this value by adding addition state types, you should
remove ``room_invite_state_types`` and configure ``additional_event_types`` with
your customisations.

If you have customised this value by removing state types, you should rename
``room_invite_state_types`` to ``additional_event_types``, and set
``disable_default_event_types`` to ``true``.

Upgrading to v1.33.0
====================

Expand Down
1 change: 1 addition & 0 deletions changelog.d/9881.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add experimental option to track memory usage of the caches.
1 change: 1 addition & 0 deletions changelog.d/9882.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Export jemalloc stats to Prometheus if it is being used.
1 change: 1 addition & 0 deletions changelog.d/9902.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add limits to how often Synapse will GC, ensuring that large servers do not end up GC thrashing if `gc_thresholds` has not been correctly set.
1 change: 1 addition & 0 deletions changelog.d/9905.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve performance of sending events for worker-based deployments using Redis.
1 change: 1 addition & 0 deletions changelog.d/9910.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where user directory could get out of sync if room visibility and membership changed in quick succession.
1 change: 1 addition & 0 deletions changelog.d/9910.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve performance after joining a large room when presence is enabled.
1 change: 1 addition & 0 deletions changelog.d/9913.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added startup_delay to docker healthcheck to reduce waiting time for coming online, updated readme for extra options, contributed by @Maquis196.
1 change: 1 addition & 0 deletions changelog.d/9915.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support stable identifiers for [MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772) Spaces. `m.space.child` events will now be taken into account when populating the experimental spaces summary response. Please see `UPGRADE.rst` if you have customised `room_invite_state_types` in your configuration.
1 change: 1 addition & 0 deletions changelog.d/9916.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve performance after joining a large room when presence is enabled.
1 change: 1 addition & 0 deletions changelog.d/9928.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Include the `origin_server_ts` property in the experimental [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946) support to allow clients to properly sort rooms.
1 change: 1 addition & 0 deletions changelog.d/9930.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bugs introduced in v1.23.0 which made the PostgreSQL port script fail when run with a newly-created SQLite database.
1 change: 1 addition & 0 deletions changelog.d/9931.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Minor fixes to the `make_full_schema.sh` script.
1 change: 1 addition & 0 deletions changelog.d/9932.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move database schema files into a common directory.
1 change: 1 addition & 0 deletions changelog.d/9935.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve performance of backfilling in large rooms.
1 change: 1 addition & 0 deletions changelog.d/9945.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a config option to allow you to prevent device display names from being shared over federation. Contributed by @aaronraimist.
1 change: 1 addition & 0 deletions changelog.d/9947.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update support for [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946): Spaces Summary.
1 change: 1 addition & 0 deletions changelog.d/9950.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve performance of sending events for worker-based deployments using Redis.
1 change: 1 addition & 0 deletions changelog.d/9954.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update support for [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946): Spaces Summary.
1 change: 1 addition & 0 deletions changelog.d/9959.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add debug logging for lost/delayed to-device messages.
1 change: 1 addition & 0 deletions changelog.d/9961.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in Synapse 1.29.0 which caused `m.room_key_request` to-device messages sent from one user to another to be dropped.
1 change: 1 addition & 0 deletions changelog.d/9965.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in Synapse 1.29.0 which caused `m.room_key_request` to-device messages sent from one user to another to be dropped.
1 change: 1 addition & 0 deletions changelog.d/9966.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support stable identifiers for [MSC1772](https://github.com/matrix-org/matrix-doc/pull/1772) Spaces. `m.space.child` events will now be taken into account when populating the experimental spaces summary response. Please see `UPGRADE.rst` if you have customised `room_invite_state_types` in your configuration.
12 changes: 12 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
matrix-synapse-py3 (1.33.2) stable; urgency=medium

* New synapse release 1.33.2.

-- Synapse Packaging team <packages@matrix.org> Tue, 11 May 2021 11:17:59 +0100

matrix-synapse-py3 (1.33.1) stable; urgency=medium

* New synapse release 1.33.1.

-- Synapse Packaging team <packages@matrix.org> Thu, 06 May 2021 14:06:33 +0100

matrix-synapse-py3 (1.33.0) stable; urgency=medium

* New synapse release 1.33.0.
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ EXPOSE 8008/tcp 8009/tcp 8448/tcp

ENTRYPOINT ["/start.py"]

HEALTHCHECK --interval=1m --timeout=5s \
HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \
CMD curl -fSs http://localhost:8008/health || exit 1
17 changes: 14 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ whilst running the above `docker run` commands.
```
--no-healthcheck
```

## Disabling the healthcheck in docker-compose file

If you wish to disable the healthcheck via docker-compose, append the following to your service configuration.

```
healthcheck:
disable: true
```

## Setting custom healthcheck on docker run

If you wish to point the healthcheck at a different port with docker command, add the following
Expand All @@ -202,14 +212,15 @@ If you wish to point the healthcheck at a different port with docker command, ad
## Setting the healthcheck in docker-compose file

You can add the following to set a custom healthcheck in a docker compose file.
You will need version >2.1 for this to work.
You will need docker-compose version >2.1 for this to work.

```
healthcheck:
test: ["CMD", "curl", "-fSs", "http://localhost:8008/health"]
interval: 1m
timeout: 10s
interval: 15s
timeout: 5s
retries: 3
start_period: 5s
```

## Using jemalloc
Expand Down
17 changes: 17 additions & 0 deletions docs/sample_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ presence:
#
#gc_thresholds: [700, 10, 10]

# The minimum time in seconds between each GC for a generation, regardless of
# the GC thresholds. This ensures that we don't do GC too frequently.
#
# A value of `[1s, 10s, 30s]` indicates that a second must pass between consecutive
# generation 0 GCs, etc.
#
# Defaults to `[1s, 10s, 30s]`.
#
#gc_min_interval: [0.5s, 30s, 1m]

# Set the limit on the returned events in the timeline in the get
# and sync operations. The default value is 100. -1 means no upper limit.
#
Expand Down Expand Up @@ -731,6 +741,12 @@ acme:
#
#allow_profile_lookup_over_federation: false

# Uncomment to disable device display name lookup over federation. By default, the
# Federation API allows other homeservers to obtain device display names of any user
# on this homeserver. Defaults to 'true'.
#
#allow_device_name_lookup_over_federation: false


## Caching ##

Expand Down Expand Up @@ -1512,6 +1528,7 @@ room_prejoin_state:
# - m.room.avatar
# - m.room.encryption
# - m.room.name
# - m.room.create
#
# Uncomment the following to disable these defaults (so that only the event
# types listed in 'additional_event_types' are shared). Defaults to 'false'.
Expand Down
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,6 @@ ignore_missing_imports = True

[mypy-txacme.*]
ignore_missing_imports = True

[mypy-pympler.*]
ignore_missing_imports = True
Loading

0 comments on commit dacc395

Please sign in to comment.