diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2017-03-20 11:53:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-20 11:53:36 +0000 |
commit | eddce9d74abce0e0e65d5292149933ed9bf6025a (patch) | |
tree | b4db8fbbb01c3ee21724aa5eea4639c01ca23f5e /synapse/app/homeserver.py | |
parent | Merge pull request #2025 from matrix-org/rav/no_reset_state_on_rejections (diff) | |
parent | Stop preserve_fn leaking context into the reactor (diff) | |
download | synapse-eddce9d74abce0e0e65d5292149933ed9bf6025a.tar.xz |
Merge pull request #2027 from matrix-org/rav/logcontext_leaks
A few fixes to logcontext things
Diffstat (limited to 'synapse/app/homeserver.py')
-rwxr-xr-x | synapse/app/homeserver.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 0b9d78c13c..2cdd2d39ff 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -52,7 +52,7 @@ from synapse.api.urls import ( ) from synapse.config.homeserver import HomeServerConfig from synapse.crypto import context_factory -from synapse.util.logcontext import LoggingContext +from synapse.util.logcontext import LoggingContext, PreserveLoggingContext from synapse.metrics import register_memory_metrics, get_metrics_for from synapse.metrics.resource import MetricsResource, METRICS_PREFIX from synapse.replication.resource import ReplicationResource, REPLICATION_PREFIX @@ -456,7 +456,12 @@ def run(hs): def in_thread(): # Uncomment to enable tracing of log context changes. # sys.settrace(logcontext_tracer) - with LoggingContext("run"): + + # make sure that we run the reactor with the sentinel log context, + # otherwise other PreserveLoggingContext instances will get confused + # and complain when they see the logcontext arbitrarily swapping + # between the sentinel and `run` logcontexts. + with PreserveLoggingContext(): change_resource_limit(hs.config.soft_file_limit) if hs.config.gc_thresholds: gc.set_threshold(*hs.config.gc_thresholds) |