Repository: matrix-org/synapse

Issue:
`TypeError: not all arguments converted during string formatting` on SIGHUP
After I send my synapse a SIGHUP:

```
2022-10-21 13:50:03,303 - twisted - 274 - ERROR - sentinel - --- Logging error ---
2022-10-21 13:50:03,313 - twisted - 274 - ERROR - sentinel - Traceback (most recent call last):
2022-10-21 13:50:03,314 - twisted - 274 - ERROR - sentinel -   File "/usr/lib/python3.10/logging/__init__.py", line 1100, in emit
2022-10-21 13:50:03,314 - twisted - 274 - ERROR - sentinel -     msg = self.format(record)
2022-10-21 13:50:03,314 - twisted - 274 - ERROR - sentinel -   File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
2022-10-21 13:50:03,314 - twisted - 274 - ERROR - sentinel -     return fmt.format(record)
2022-10-21 13:50:03,314 - twisted - 274 - ERROR - sentinel -   File "/usr/lib/python3.10/logging/__init__.py", line 678, in format
2022-10-21 13:50:03,314 - twisted - 274 - ERROR - sentinel -     record.message = record.getMessage()
2022-10-21 13:50:03,314 - twisted - 274 - ERROR - sentinel -   File "/usr/lib/python3.10/logging/__init__.py", line 368, in getMessage
2022-10-21 13:50:03,315 - twisted - 274 - ERROR - sentinel -     msg = msg % self.args
2022-10-21 13:50:03,315 - twisted - 274 - ERROR - sentinel - TypeError: not all arguments converted during string formatting
2022-10-21 13:50:03,315 - twisted - 274 - ERROR - sentinel - Call stack:
2022-10-21 13:50:03,315 - twisted - 274 - ERROR - sentinel -   File "/usr/local/pycharm-community-2022.1.3/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 795, in __call__
2022-10-21 13:50:03,315 - twisted - 274 - ERROR - sentinel -     ret = self.original_func(*self.args, **self.kwargs)
2022-10-21 13:50:03,316 - twisted - 274 - ERROR - sentinel -   File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
2022-10-21 13:50:03,316 - twisted - 274 - ERROR - sentinel -     self._bootstrap_inner()
2022-10-21 13:50:03,316 - twisted - 274 - ERROR - sentinel -   File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
2022-10-21 13:50:03,316 - twisted - 274 - ERROR - sentinel -     self.run()
2022-10-21 13:50:03,316 - twisted - 274 - ERROR - sentinel -   File "/usr/lib/python3.10/threading.py", line 953, in run
2022-10-21 13:50:03,317 - twisted - 274 - ERROR - sentinel -     self._target(*self._args, **self._kwargs)
2022-10-21 13:50:03,317 - twisted - 274 - ERROR - sentinel -   File "/home/rav/work/synapse/synapse/logging/handlers.py", line 84, in _flush_periodically
2022-10-21 13:50:03,317 - twisted - 274 - ERROR - sentinel -     self.flush()
2022-10-21 13:50:03,317 - twisted - 274 - ERROR - sentinel - Message: 'New cache config. Was:\n %s\nNow:\n'
2022-10-21 13:50:03,317 - twisted - 274 - ERROR - sentinel - Arguments: ({'root': None, 'default_template_dir': '/home/rav/work/synapse/synapse/res/templates', 'event_cache_size': 102400, 'cache_factors': {}, 'global_factor': 0.5, 'track_memory_usage': False, 'expiry_time_msec': 1800000, 'cache_autotuning': None, 'sync_response_cache_duration': 120000}, {'root': <synapse.config.homeserver.HomeServerConfig object at 0x7ffb0012fb50>, 'default_template_dir': '/home/rav/work/synapse/synapse/res/templates', 'event_cache_size': 102400, 'cache_factors': {}, 'global_factor': 0.5, 'track_memory_usage': False, 'expiry_time_msec': 1800000, 'cache_autotuning': None, 'sync_response_cache_duration': 120000})
```

looks like a missing %s in https://github.com/matrix-org/synapse/tree/v1.69.0/synapse/app/_base.py#L560-L564


Discussion:

Resolving patch:
diff --git a/synapse/app/_base.py b/synapse/app/_base.py
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -558,7 +558,7 @@ def reload_cache_config(config: HomeServerConfig) -> None:
             logger.warning(f)
     else:
         logger.debug(
-            "New cache config. Was:\n %s\nNow:\n",
+            "New cache config. Was:\n %s\nNow:\n %s",
             previous_cache_config.__dict__,
             config.caches.__dict__,
         )


Test patch: