summaryrefslogtreecommitdiff
path: root/synapse/app/_base.py
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2020-09-23 10:00:31 +0200
committerAndrej Shadura <andrewsh@debian.org>2020-09-23 10:00:31 +0200
commitc4b994b356a5af29bdf1f8648dd7d929a237acbd (patch)
tree6163eda9a9a5329caea1cf5b4ad42b974cc1ae3b /synapse/app/_base.py
parenta8007890d174f089f2ce28aae9d919df346f74f9 (diff)
New upstream version 1.20.0
Diffstat (limited to 'synapse/app/_base.py')
-rw-r--r--synapse/app/_base.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/synapse/app/_base.py b/synapse/app/_base.py
index 2b2cd795..fb476dda 100644
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -334,6 +334,13 @@ def install_dns_limiter(reactor, max_dns_requests_in_flight=100):
This is to workaround https://twistedmatrix.com/trac/ticket/9620, where we
can run out of file descriptors and infinite loop if we attempt to do too
many DNS queries at once
+
+ XXX: I'm confused by this. reactor.nameResolver does not use twisted.names unless
+ you explicitly install twisted.names as the resolver; rather it uses a GAIResolver
+ backed by the reactor's default threadpool (which is limited to 10 threads). So
+ (a) I don't understand why twisted ticket 9620 is relevant, and (b) I don't
+ understand why we would run out of FDs if we did too many lookups at once.
+ -- richvdh 2020/08/29
"""
new_resolver = _LimitedHostnameResolver(
reactor.nameResolver, max_dns_requests_in_flight
@@ -342,7 +349,7 @@ def install_dns_limiter(reactor, max_dns_requests_in_flight=100):
reactor.installNameResolver(new_resolver)
-class _LimitedHostnameResolver(object):
+class _LimitedHostnameResolver:
"""Wraps a IHostnameResolver, limiting the number of in-flight DNS lookups.
"""
@@ -402,7 +409,7 @@ class _LimitedHostnameResolver(object):
yield deferred
-class _DeferredResolutionReceiver(object):
+class _DeferredResolutionReceiver:
"""Wraps a IResolutionReceiver and simply resolves the given deferred when
resolution is complete
"""