Merge remote-tracking branch 'upstream/rawhide' into alex

This commit is contained in:
Alex Manning 2022-03-21 20:32:20 +00:00
commit f08ce7bd2f
4 changed files with 15 additions and 134 deletions

View file

@ -1,4 +1,4 @@
From 3a65f800f75e11bd9c3a7db167644f9ebec444c1 Mon Sep 17 00:00:00 2001 From 2f194c0773550f263136ab6ed1f01bf2611e1049 Mon Sep 17 00:00:00 2001
From: Dan Callaghan <djc@djc.id.au> From: Dan Callaghan <djc@djc.id.au>
Date: Sun, 18 Jul 2021 13:18:10 +1000 Date: Sun, 18 Jul 2021 13:18:10 +1000
Subject: [PATCH] relax cryptography dependency version requirement Subject: [PATCH] relax cryptography dependency version requirement
@ -12,10 +12,10 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1978949
1 file changed, 1 insertion(+), 3 deletions(-) 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py
index d844fbb3b3..277bd043a9 100644 index b40a7bbb76..e32c2c5901 100644
--- a/synapse/python_dependencies.py --- a/synapse/python_dependencies.py
+++ b/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py
@@ -84,9 +84,7 @@ REQUIREMENTS = [ @@ -77,9 +77,7 @@ REQUIREMENTS = [
"Jinja2>=2.9", "Jinja2>=2.9",
"bleach>=1.4.3", "bleach>=1.4.3",
"typing-extensions>=3.7.4", "typing-extensions>=3.7.4",
@ -23,9 +23,9 @@ index d844fbb3b3..277bd043a9 100644
- # with the latest security patches. - # with the latest security patches.
- "cryptography>=3.4.7", - "cryptography>=3.4.7",
+ "cryptography>=3.4", + "cryptography>=3.4",
"ijson>=3.1", # ijson 3.1.4 fixes a bug with "." in property names
"matrix-common==1.0.0", "ijson>=3.1.4",
] "matrix-common~=1.1.0",
-- --
2.34.1 2.35.1

View file

@ -1,74 +0,0 @@
From b5a1489e0c00701aee43ca207cdde093726890e4 Mon Sep 17 00:00:00 2001
From: reivilibre <oliverw@matrix.org>
Date: Wed, 2 Feb 2022 16:51:00 +0000
Subject: [PATCH 2/2] Fix type errors introduced by new annotations in the
Prometheus Client library. (#11832)
Co-authored-by: David Robertson <davidr@element.io>
---
changelog.d/11832.misc | 1 +
synapse/metrics/__init__.py | 10 +++++++++-
synapse/python_dependencies.py | 3 +--
3 files changed, 11 insertions(+), 3 deletions(-)
create mode 100644 changelog.d/11832.misc
diff --git a/changelog.d/11832.misc b/changelog.d/11832.misc
new file mode 100644
index 0000000000..5ff117d933
--- /dev/null
+++ b/changelog.d/11832.misc
@@ -0,0 +1 @@
+Fix type errors introduced by new annotations in the Prometheus Client library.
\ No newline at end of file
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py
index 9e6c1b2f3b..cca084c18c 100644
--- a/synapse/metrics/__init__.py
+++ b/synapse/metrics/__init__.py
@@ -30,6 +30,7 @@ from typing import (
Type,
TypeVar,
Union,
+ cast,
)
import attr
@@ -60,7 +61,7 @@ all_gauges: "Dict[str, Union[LaterGauge, InFlightGauge]]" = {}
HAVE_PROC_SELF_STAT = os.path.exists("/proc/self/stat")
-class RegistryProxy:
+class _RegistryProxy:
@staticmethod
def collect() -> Iterable[Metric]:
for metric in REGISTRY.collect():
@@ -68,6 +69,13 @@ class RegistryProxy:
yield metric
+# A little bit nasty, but collect() above is static so a Protocol doesn't work.
+# _RegistryProxy matches the signature of a CollectorRegistry instance enough
+# for it to be usable in the contexts in which we use it.
+# TODO Do something nicer about this.
+RegistryProxy = cast(CollectorRegistry, _RegistryProxy)
+
+
@attr.s(slots=True, hash=True, auto_attribs=True)
class LaterGauge:
diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py
index d25f6e18e3..c7cfa9ae87 100644
--- a/synapse/python_dependencies.py
+++ b/synapse/python_dependencies.py
@@ -76,8 +76,7 @@ REQUIREMENTS = [
"msgpack>=0.5.2",
"phonenumbers>=8.2.0",
# we use GaugeHistogramMetric, which was added in prom-client 0.4.0.
- # 0.13.0 has an incorrect type annotation, see #11832.
- "prometheus_client>=0.4.0,<0.13.0",
+ "prometheus_client>=0.4.0",
# we use `order`, which arrived in attrs 19.2.0.
# Note: 21.1.0 broke `/sync`, see #9936
"attrs>=19.2.0,!=21.1.0",
--
2.34.1

View file

@ -1,48 +0,0 @@
From a160ac1d4e42e2a753172f939bead7d6c21ce0cd Mon Sep 17 00:00:00 2001
From: David Robertson <davidr@element.io>
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

View file

@ -2,7 +2,7 @@
# Version suffix in URL when building release candidates # Version suffix in URL when building release candidates
%global rcx %{nil} %global rcx %{nil}
%global ghversion 1.52.0 %global ghversion 1.54.0
%{?python_enable_dependency_generator} %{?python_enable_dependency_generator}
@ -26,9 +26,6 @@ Source4: synapse@.service
Source3: matrix-synapse.sysusers Source3: matrix-synapse.sysusers
# non-upstreamable patch to accept any version of python-cryptography, see RHBZ#1978949 # non-upstreamable patch to accept any version of python-cryptography, see RHBZ#1978949
Patch1: 0001-relax-cryptography-dependency-version-requirement.patch 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 BuildArch: noarch
BuildRequires: python3-devel BuildRequires: python3-devel
@ -48,7 +45,7 @@ BuildRequires: python3-canonicaljson >= 1.4.0
# v3.4.7 affects only the binary distribution, so using v3.4.6 is fine. # v3.4.7 affects only the binary distribution, so using v3.4.6 is fine.
BuildRequires: python3-cryptography >= 3.4.6 BuildRequires: python3-cryptography >= 3.4.6
BuildRequires: python3-daemonize >= 2.3.1 BuildRequires: python3-daemonize >= 2.3.1
BuildRequires: python3-frozendict >= 1.0 BuildRequires: (python3-frozendict without python3-frozendict = 2.1.2)
BuildRequires: python3-idna >= 2.5 BuildRequires: python3-idna >= 2.5
BuildRequires: python3-ijson BuildRequires: python3-ijson
BuildRequires: python3-jinja2 >= 2.9 BuildRequires: python3-jinja2 >= 2.9
@ -157,6 +154,12 @@ PYTHONPATH=. trial-3 tests
%changelog %changelog
* Tue Mar 08 2022 Kai A. Hiller <V02460@gmail.com> - 1.54.0-1
- Update to v1.54.0
* Tue Feb 22 2022 Kai A. Hiller <V02460@gmail.com> - 1.53.0-1
- Update to v1.53.0
* Wed Feb 09 2022 Kai A. Hiller <V02460@gmail.com> - 1.52.0-2 * Wed Feb 09 2022 Kai A. Hiller <V02460@gmail.com> - 1.52.0-2
- Backport: Fix losing incoming EDUs if debug logging enabled - Backport: Fix losing incoming EDUs if debug logging enabled