From 2c55219c1c5b0a00bbe97eb0ca6b0bc4cb2f8329 Mon Sep 17 00:00:00 2001 From: "Kai A. Hiller" Date: Wed, 9 Feb 2022 16:53:08 +0100 Subject: [PATCH] Fix losing incoming EDUs if debug logging enabled --- ...ing-EDUs-if-debug-logging-enabled-11.patch | 48 +++++++++++++++++++ matrix-synapse.spec | 6 ++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 0003-Fix-losing-incoming-EDUs-if-debug-logging-enabled-11.patch diff --git a/0003-Fix-losing-incoming-EDUs-if-debug-logging-enabled-11.patch b/0003-Fix-losing-incoming-EDUs-if-debug-logging-enabled-11.patch new file mode 100644 index 0000000..650be19 --- /dev/null +++ b/0003-Fix-losing-incoming-EDUs-if-debug-logging-enabled-11.patch @@ -0,0 +1,48 @@ +From a160ac1d4e42e2a753172f939bead7d6c21ce0cd Mon Sep 17 00:00:00 2001 +From: David Robertson +Date: Wed, 2 Feb 2022 16:25:17 +0000 +Subject: [PATCH 3/3] Fix losing incoming EDUs if debug logging enabled + (#11890) + +* Fix losing incoming EDUs if debug logging enabled + +Fixes #11889. Homeservers should only be affected if the +`synapse.8631_debug` logger was enabled for DEBUG mode. + +I am not sure if this merits a bugfix release: I think the logging can +be disabled in config if anyone is affected? But it is still pretty bad. +--- + changelog.d/11890.bugfix | 1 + + synapse/federation/transport/server/federation.py | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + create mode 100644 changelog.d/11890.bugfix + +diff --git a/changelog.d/11890.bugfix b/changelog.d/11890.bugfix +new file mode 100644 +index 0000000000..6b696692e3 +--- /dev/null ++++ b/changelog.d/11890.bugfix +@@ -0,0 +1 @@ ++Fix a bug introduced in Synapse 1.51.0rc1 where incoming federation transactions containing at least one EDU would be dropped if debug logging was enabled for `synapse.8631_debug`. +\ No newline at end of file +diff --git a/synapse/federation/transport/server/federation.py b/synapse/federation/transport/server/federation.py +index 9c1ad5851f..d86dfede4e 100644 +--- a/synapse/federation/transport/server/federation.py ++++ b/synapse/federation/transport/server/federation.py +@@ -109,11 +109,11 @@ class FederationSendServlet(BaseFederationServerServlet): + ) + + if issue_8631_logger.isEnabledFor(logging.DEBUG): +- DEVICE_UPDATE_EDUS = {"m.device_list_update", "m.signing_key_update"} ++ DEVICE_UPDATE_EDUS = ["m.device_list_update", "m.signing_key_update"] + device_list_updates = [ + edu.content + for edu in transaction_data.get("edus", []) +- if edu.edu_type in DEVICE_UPDATE_EDUS ++ if edu.get("edu_type") in DEVICE_UPDATE_EDUS + ] + if device_list_updates: + issue_8631_logger.debug( +-- +2.34.1 + diff --git a/matrix-synapse.spec b/matrix-synapse.spec index c8bbc59..d2c117a 100644 --- a/matrix-synapse.spec +++ b/matrix-synapse.spec @@ -7,7 +7,7 @@ Name: matrix-%{srcname} Version: 1.52.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A Matrix reference homeserver written in Python using Twisted License: ASL 2.0 URL: https://github.com/matrix-org/%{srcname} @@ -18,6 +18,7 @@ Source3: matrix-synapse.sysusers # non-upstreamable patch to accept any version of python-cryptography, see RHBZ#1978949 Patch1: 0001-relax-cryptography-dependency-version-requirement.patch Patch2: 0002-Fix-type-errors-introduced-by-new-annotations-in-the.patch +Patch3: 0003-Fix-losing-incoming-EDUs-if-debug-logging-enabled-11.patch BuildArch: noarch BuildRequires: python3-devel @@ -140,6 +141,9 @@ PYTHONPATH=. trial-3 tests %changelog +* Wed Feb 09 2022 Kai A. Hiller - 1.52.0-2 +- Backport: Fix losing incoming EDUs if debug logging enabled + * Tue Feb 08 2022 Kai A. Hiller - 1.52.0-1 - Update to v1.52.0 - Create synapse user and group declaratively