0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2025-03-15 19:00:04 +01:00

Shut down the DNS threadpool ()

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
changelog.d
synapse/app

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. # numbers of DNS requests don't starve out other users of the threadpool.
resolver_threadpool = ThreadPool(name="gai_resolver") resolver_threadpool = ThreadPool(name="gai_resolver")
resolver_threadpool.start() resolver_threadpool.start()
reactor.addSystemEventTrigger("during", "shutdown", resolver_threadpool.stop)
reactor.installNameResolver( reactor.installNameResolver(
GAIResolver(reactor, getThreadPool=lambda: resolver_threadpool) GAIResolver(reactor, getThreadPool=lambda: resolver_threadpool)
) )