diff --git a/changelog.d/10517.bugfix b/changelog.d/10517.bugfix
new file mode 100644
index 0000000000000000000000000000000000000000..5b044bb34dd8c7f682f0ac2d0a0deb46e0d5ab58
--- /dev/null
+++ b/changelog.d/10517.bugfix
@@ -0,0 +1 @@
+Fix the `PeriodicallyFlushingMemoryHandler` inhibiting application shutdown because of its background thread.
diff --git a/synapse/logging/handlers.py b/synapse/logging/handlers.py
index a6c212f300fd18f009119981e665203e6cb5e93b..af5fc407a8e5e1445db74a921fc06dba4df99437 100644
--- a/synapse/logging/handlers.py
+++ b/synapse/logging/handlers.py
@@ -45,6 +45,7 @@ class PeriodicallyFlushingMemoryHandler(MemoryHandler):
         self._flushing_thread: Thread = Thread(
             name="PeriodicallyFlushingMemoryHandler flushing thread",
             target=self._flush_periodically,
+            daemon=True,
         )
         self._flushing_thread.start()