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

Commit 5e8c7b4

Browse files
committed
Merge remote-tracking branch 'origin/develop' into hs/hacked-together-event-cache
2 parents d77072f + 4b2217a commit 5e8c7b4

File tree

6 files changed

+49
-15
lines changed

6 files changed

+49
-15
lines changed

CHANGES.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1+
Synapse 1.32.1 (2021-04-21)
2+
===========================
3+
4+
This release fixes [a regression](https://github.com/matrix-org/synapse/issues/9853)
5+
in Synapse 1.32.0 that caused connected Prometheus instances to become unstable. If you
6+
ran Synapse 1.32.0 with Prometheus metrics, first upgrade to Synapse 1.32.1 and follow
7+
[these instructions](https://github.com/matrix-org/synapse/pull/9854#issuecomment-823472183)
8+
to clean up any excess writeahead logs.
9+
10+
Bugfixes
11+
--------
12+
13+
- Fix a regression in Synapse 1.32.0 which caused Synapse to report large numbers of Prometheus time series, potentially overwhelming Prometheus instances. ([\#9854](https://github.com/matrix-org/synapse/issues/9854))
14+
15+
116
Synapse 1.32.0 (2021-04-20)
217
===========================
318

4-
**Note:** This release introduces [a regression](https://githubcom/matrix-org/synapse/issues/9853)
19+
**Note:** This release introduces [a regression](https://github.com/matrix-org/synapse/issues/9853)
520
that can overwhelm connected Prometheus instances. This issue was not present in
6-
Synapse v1.32.0rc1. It is recommended not to update to this release. If you have
7-
upgraded to v1.32.0 already, please downgrade to v1.31.0. This issue will be
8-
resolved in a subsequent release version shortly.
21+
1.32.0rc1, and is fixed in 1.32.1. See the changelog for 1.32.1 above for more information.
922

1023
**Note:** This release requires Python 3.6+ and Postgres 9.6+ or SQLite 3.22+.
1124

UPGRADE.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ Upgrading to v1.32.0
114114
Regression causing connected Prometheus instances to become overwhelmed
115115
-----------------------------------------------------------------------
116116

117-
This release introduces `a regression <https://githubcom/matrix-org/synapse/issues/9853>`_
118-
that can overwhelm connected Prometheus instances. This issue was not present in
119-
Synapse v1.32.0rc1. It is recommended not to update to this release. If you have
120-
upgraded to v1.32.0 already, please downgrade to v1.31.0. This issue will be
121-
resolved in a subsequent release version shortly.
117+
This release introduces `a regression <https://github.com/matrix-org/synapse/issues/9853>`_
118+
that can overwhelm connected Prometheus instances. This issue is not present in
119+
Synapse v1.32.0rc1, and is fixed in Synapse v1.32.1.
120+
121+
If you have been affected, please first upgrade to a more recent Synapse version.
122+
You then may need to remove excess writeahead logs in order for Prometheus to recover.
123+
Instructions for doing so are provided
124+
`here <https://github.com/matrix-org/synapse/pull/9854#issuecomment-823472183>`_.
122125

123126
Dropping support for old Python, Postgres and SQLite versions
124127
-------------------------------------------------------------

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
matrix-synapse-py3 (1.32.1) stable; urgency=medium
2+
3+
* New synapse release 1.32.1.
4+
5+
-- Synapse Packaging team <[email protected]> Wed, 21 Apr 2021 14:00:55 +0100
6+
17
matrix-synapse-py3 (1.32.0) stable; urgency=medium
28

39
[ Dan Callahan ]

synapse/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
except ImportError:
4848
pass
4949

50-
__version__ = "1.32.0"
50+
__version__ = "1.32.1"
5151

5252
if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
5353
# We import here so that we don't have to install a bunch of deps when

synapse/metrics/background_process_metrics.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import logging
1616
import threading
1717
from functools import wraps
18-
from typing import TYPE_CHECKING, Dict, Optional, Set
18+
from typing import TYPE_CHECKING, Dict, Optional, Set, Union
1919

2020
from prometheus_client.core import REGISTRY, Counter, Gauge
2121

@@ -198,7 +198,7 @@ async def run():
198198
_background_process_start_count.labels(desc).inc()
199199
_background_process_in_flight_count.labels(desc).inc()
200200

201-
with BackgroundProcessLoggingContext("%s-%s" % (desc, count)) as context:
201+
with BackgroundProcessLoggingContext(desc, count) as context:
202202
try:
203203
ctx = noop_context_manager()
204204
if bg_start_span:
@@ -243,8 +243,20 @@ class BackgroundProcessLoggingContext(LoggingContext):
243243

244244
__slots__ = ["_proc"]
245245

246-
def __init__(self, name: str):
247-
super().__init__(name)
246+
def __init__(self, name: str, instance_id: Optional[Union[int, str]] = None):
247+
"""
248+
249+
Args:
250+
name: The name of the background process. Each distinct `name` gets a
251+
separate prometheus time series.
252+
253+
instance_id: an identifer to add to `name` to distinguish this instance of
254+
the named background process in the logs. If this is `None`, one is
255+
made up based on id(self).
256+
"""
257+
if instance_id is None:
258+
instance_id = id(self)
259+
super().__init__("%s-%s" % (name, instance_id))
248260
self._proc = _BackgroundProcess(name, self)
249261

250262
def start(self, rusage: "Optional[resource._RUsage]"):

synapse/replication/tcp/protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def __init__(self, clock: Clock, handler: "ReplicationCommandHandler"):
184184
# a logcontext which we use for processing incoming commands. We declare it as a
185185
# background process so that the CPU stats get reported to prometheus.
186186
self._logging_context = BackgroundProcessLoggingContext(
187-
"replication-conn-%s" % (self.conn_id,)
187+
"replication-conn", self.conn_id
188188
)
189189

190190
def connectionMade(self):

0 commit comments

Comments
 (0)