summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/server.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index c250a4604f..06935783ca 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -208,6 +208,9 @@ class JsonResource(HttpServer, resource.Resource):
         if request.method == "OPTIONS":
             self._send_response(request, 200, {})
             return
+
+        start_context = LoggingContext.current_context()
+
         # Loop through all the registered callbacks to check if the method
         # and path regex match
         for path_entry in self.path_regexs.get(request.method, []):
@@ -243,6 +246,13 @@ class JsonResource(HttpServer, resource.Resource):
                 if context:
                     tag = context.tag
 
+                    if context != start_context:
+                        logger.warn(
+                            "Context have unexpectedly changed %r, %r",
+                            context, self.start_context
+                        )
+                        return
+
                 incoming_requests_counter.inc(request.method, servlet_classname, tag)
 
                 response_timer.inc_by(