Shut down the DNS threadpool (#11190)

The DNS threadpool must be explicitly stopped, otherwise Synapse will
hang indefinitely when asked to shut down.
This commit is contained in:
Sean Quah 2021-10-27 13:04:56 +01:00 committed by GitHub
parent 72626b78ef
commit f3a4be8700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

1
changelog.d/11190.bugfix Normal file
View File

@ -0,0 +1 @@
Fix a performance regression introduced in 1.44.0 which could cause client requests to time out when making large numbers of outbound requests.

View File

@ -346,6 +346,7 @@ async def start(hs: "HomeServer"):
# numbers of DNS requests don't starve out other users of the threadpool.
resolver_threadpool = ThreadPool(name="gai_resolver")
resolver_threadpool.start()
reactor.addSystemEventTrigger("during", "shutdown", resolver_threadpool.stop)
reactor.installNameResolver(
GAIResolver(reactor, getThreadPool=lambda: resolver_threadpool)
)