Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Shut down the DNS threadpool (#11190)
Browse files Browse the repository at this point in the history
The DNS threadpool must be explicitly stopped, otherwise Synapse will
hang indefinitely when asked to shut down.
  • Loading branch information
squahtx authored Oct 27, 2021
1 parent 72626b7 commit f3a4be8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/11190.bugfix
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down

0 comments on commit f3a4be8

Please sign in to comment.