From c1b3dc11428f0ae48a8f895e821104a8004ee4f0 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 13 Jul 2019 23:07:29 -0700 Subject: [PATCH] modules/federation/sender: Don't propagate exceptions outside of the hook handler. --- modules/client/sync.cc | 14 ++++++++++++++ modules/federation/sender.cc | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/modules/client/sync.cc b/modules/client/sync.cc index 7f2298317..5b0112bed 100644 --- a/modules/client/sync.cc +++ b/modules/client/sync.cc @@ -755,6 +755,7 @@ ircd::m::sync::longpoll::notified void ircd::m::sync::longpoll::handle_notify(const m::event &event, m::vm::eval &eval) +try { assert(eval.opts); if(!eval.opts->notify_clients) @@ -762,6 +763,19 @@ ircd::m::sync::longpoll::handle_notify(const m::event &event, dock.notify_all(); } +catch(const ctx::interrupted &) +{ + throw; +} +catch(const std::exception &e) +{ + log::critical + { + log, "request %s longpoll notify :%s", + loghead(eval), + e.what(), + }; +} /// Longpolling blocks the client's request until a relevant event is processed /// by the m::vm. If no event is processed by a timeout this returns false. diff --git a/modules/federation/sender.cc b/modules/federation/sender.cc index 313a07e0b..bcddbb9df 100644 --- a/modules/federation/sender.cc +++ b/modules/federation/sender.cc @@ -71,6 +71,7 @@ notified void handle_notify(const m::event &event, m::vm::eval &eval) +try { if(!my(event)) return; @@ -89,6 +90,18 @@ handle_notify(const m::event &event, notified_queue.emplace_back(json::strung{event}, event_id); notified_dock.notify_all(); } +catch(const ctx::interrupted &) +{ + throw; +} +catch(const std::exception &e) +{ + log::critical + { + m::log, "Federation sender notify handler :%s", + e.what() + }; +} void __attribute__((noreturn))