From 1d9df51ff1129f86157e54f0523cec0ddadcbd41 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 22 Feb 2019 14:47:48 +0000 Subject: [PATCH 1/5] Correctly handle null data in HttpPusher --- synapse/push/httppusher.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/synapse/push/httppusher.py b/synapse/push/httppusher.py index 899a5253d..e65f8c63d 100644 --- a/synapse/push/httppusher.py +++ b/synapse/push/httppusher.py @@ -97,6 +97,11 @@ class HttpPusher(object): pusherdict['pushkey'], ) + if self.data is None: + raise PusherConfigException( + "data can not be null for HTTP pusher" + ) + if 'url' not in self.data: raise PusherConfigException( "'url' required in data for HTTP pusher" From a164134a53417bfa3f126671b02be7e83376aacd Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 22 Feb 2019 14:48:06 +0000 Subject: [PATCH 2/5] Drop logging level of creating a pusher --- synapse/push/pusher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/push/pusher.py b/synapse/push/pusher.py index 368d5094b..b33f2a357 100644 --- a/synapse/push/pusher.py +++ b/synapse/push/pusher.py @@ -56,7 +56,7 @@ class PusherFactory(object): f = self.pusher_types.get(kind, None) if not f: return None - logger.info("creating %s pusher for %r", kind, pusherdict) + logger.debug("creating %s pusher for %r", kind, pusherdict) return f(self.hs, pusherdict) def _create_email_pusher(self, _hs, pusherdict): From 5d3e3c051df4650e47e3ee5f243765771fb8e248 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 22 Feb 2019 14:51:33 +0000 Subject: [PATCH 3/5] Newsfile --- changelog.d/4716.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4716.misc diff --git a/changelog.d/4716.misc b/changelog.d/4716.misc new file mode 100644 index 000000000..5935f3af2 --- /dev/null +++ b/changelog.d/4716.misc @@ -0,0 +1 @@ +Reduce pusher logging on startup From f2891d248756c968c346df052c796c0c69d6e764 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 22 Feb 2019 15:18:19 +0000 Subject: [PATCH 4/5] Correctly handle PusherConfigException --- synapse/push/pusherpool.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py index b2c92ce68..af82e02b4 100644 --- a/synapse/push/pusherpool.py +++ b/synapse/push/pusherpool.py @@ -19,6 +19,7 @@ import logging from twisted.internet import defer from synapse.metrics.background_process_metrics import run_as_background_process +from synapse.push import PusherConfigException from synapse.push.pusher import PusherFactory logger = logging.getLogger(__name__) @@ -222,6 +223,14 @@ class PusherPool: """ try: p = self.pusher_factory.create_pusher(pusherdict) + except PusherConfigException as e: + logger.warning( + "Pusher incorrectly configured user=%s, appid=%s, pushkey=%s: %s", + pusherdict.get('user_name'), + pusherdict.get('app_id'), + pusherdict.get('pushkey'), + e, + ) except Exception: logger.exception("Couldn't start a pusher: caught Exception") return From b82c9cf4629040681c7d06846422705734acd110 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 22 Feb 2019 15:27:40 +0000 Subject: [PATCH 5/5] Add missing return --- synapse/push/pusherpool.py | 1 + 1 file changed, 1 insertion(+) diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py index af82e02b4..abf1a1a9c 100644 --- a/synapse/push/pusherpool.py +++ b/synapse/push/pusherpool.py @@ -231,6 +231,7 @@ class PusherPool: pusherdict.get('pushkey'), e, ) + return except Exception: logger.exception("Couldn't start a pusher: caught Exception") return