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

Commit

Permalink
Merge tag 'v1.58.0rc2' into babolivier/dinsic_1.58
Browse files Browse the repository at this point in the history
Synapse 1.58.0rc2 (2022-04-26)
==============================

This release candidate fixes bugs related to Synapse 1.58.0rc1's logic for handling device list updates.

Bugfixes
--------

- Fix a bug introduced in Synapse 1.58.0rc1 where the main process could consume excessive amounts of CPU and memory while handling sentry logging failures. ([\#12554](matrix-org/synapse#12554))
- Fix a bug introduced in Synapse 1.58.0rc1 where opentracing contexts were not correctly sent to whitelisted remote servers with device lists updates. ([\#12555](matrix-org/synapse#12555))

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

- Reduce unnecessary work when handling remote device list updates. ([\#12557](matrix-org/synapse#12557))
  • Loading branch information
babolivier committed May 3, 2022
2 parents 6734337 + 9cfecd2 commit f851ba5
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 10 deletions.
20 changes: 19 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
Synapse 1.58.0rc2 (2022-04-26)
==============================

This release candidate fixes bugs related to Synapse 1.58.0rc1's logic for handling device list updates.

Bugfixes
--------

- Fix a bug introduced in Synapse 1.58.0rc1 where the main process could consume excessive amounts of CPU and memory while handling sentry logging failures. ([\#12554](https://github.com/matrix-org/synapse/issues/12554))
- Fix a bug introduced in Synapse 1.58.0rc1 where opentracing contexts were not correctly sent to whitelisted remote servers with device lists updates. ([\#12555](https://github.com/matrix-org/synapse/issues/12555))


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

- Reduce unnecessary work when handling remote device list updates. ([\#12557](https://github.com/matrix-org/synapse/issues/12557))


Synapse 1.58.0rc1 (2022-04-26)
==============================

Expand All @@ -9,7 +27,7 @@ Features
- Implement [MSC3383](https://github.com/matrix-org/matrix-spec-proposals/pull/3383) for including the destination in server-to-server authentication headers. Contributed by @Bubu and @jcgruenhage for Famedly. ([\#11398](https://github.com/matrix-org/synapse/issues/11398))
- Docker images and Debian packages from matrix.org now contain a locked set of Python dependencies, greatly improving build reproducibility. ([Board](https://github.com/orgs/matrix-org/projects/54), [\#11537](https://github.com/matrix-org/synapse/issues/11537))
- Enable processing of device list updates asynchronously. ([\#12365](https://github.com/matrix-org/synapse/issues/12365), [\#12465](https://github.com/matrix-org/synapse/issues/12465))
- Implement [MSC2815](https://github.com/matrix-org/matrix-spec-proposals/pull/2815) to allow room moderators to view redacted event content. Contributed by @tulir. ([\#12427](https://github.com/matrix-org/synapse/issues/12427))
- Implement [MSC2815](https://github.com/matrix-org/matrix-spec-proposals/pull/2815) to allow room moderators to view redacted event content. Contributed by @tulir @ Beeper. ([\#12427](https://github.com/matrix-org/synapse/issues/12427))
- Build Debian packages for Ubuntu 22.04 "Jammy Jellyfish". ([\#12543](https://github.com/matrix-org/synapse/issues/12543))


Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
matrix-synapse-py3 (1.58.0~rc2) stable; urgency=medium

* New Synapse release 1.58.0rc2.

-- Synapse Packaging team <[email protected]> Tue, 26 Apr 2022 17:14:56 +0100

matrix-synapse-py3 (1.58.0~rc1) stable; urgency=medium

* Use poetry to manage the bundled virtualenv included with this package.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ skip_gitignore = true

[tool.poetry]
name = "matrix-synapse"
version = "1.58.0rc1"
version = "1.58.0rc2"
description = "Homeserver for the Matrix decentralised comms protocol"
authors = ["Matrix.org Team and Contributors <[email protected]>"]
license = "Apache-2.0"
Expand Down
14 changes: 9 additions & 5 deletions synapse/handlers/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,9 @@ async def notify_device_update(
"device_list_key", position, users={user_id}, rooms=room_ids
)

# We may need to do some processing asynchronously.
self._handle_new_device_update_async()
# We may need to do some processing asynchronously for local user IDs.
if self.hs.is_mine_id(user_id):
self._handle_new_device_update_async()

async def notify_user_signature_update(
self, from_user_id: str, user_ids: List[str]
Expand Down Expand Up @@ -683,9 +684,12 @@ async def _handle_new_device_update_async(self) -> None:
self.federation_sender.send_device_messages(
host, immediate=False
)
log_kv(
{"message": "sent device update to host", "host": host}
)
# TODO: when called, this isn't in a logging context.
# This leads to log spam, sentry event spam, and massive
# memory usage. See #12552.
# log_kv(
# {"message": "sent device update to host", "host": host}
# )

if current_stream_id != stream_id:
# Clear the set of hosts we've already sent to as we're
Expand Down
15 changes: 13 additions & 2 deletions synapse/storage/databases/main/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,8 @@ def _add_device_outbound_room_poke_txn(
device_id,
room_id,
stream_id,
False,
# We only need to calculate outbound pokes for local users
not self.hs.is_mine_id(user_id),
encoded_context,
)
for room_id in room_ids
Expand Down Expand Up @@ -1776,7 +1777,17 @@ async def get_uncoverted_outbound_room_pokes(

def get_uncoverted_outbound_room_pokes_txn(txn):
txn.execute(sql, (limit,))
return txn.fetchall()

return [
(
user_id,
device_id,
room_id,
stream_id,
db_to_json(opentracing_context),
)
for user_id, device_id, room_id, stream_id, opentracing_context in txn
]

return await self.db_pool.runInteraction(
"get_uncoverted_outbound_room_pokes", get_uncoverted_outbound_room_pokes_txn
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/test_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def add_device_change(self, user_id, device_ids, host):
for device_id in device_ids:
stream_id = self.get_success(
self.store.add_device_change_to_streams(
"user_id", [device_id], ["!some:room"]
user_id, [device_id], ["!some:room"]
)
)

Expand Down

0 comments on commit f851ba5

Please sign in to comment.