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
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
Sean Quah committed Oct 27, 2021
1 parent 2dbef6c commit e6a477d
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 bug introduced in 1.46.0rc1 that prevented Synapse from shutting down cleanly.
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 e6a477d

Please sign in to comment.