From 06f6dd3a2ff8ba58c8edfa9ed3d2b12b0b9a7ca4 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 19 Nov 2014 19:52:54 +0000 Subject: Add disable_signal_handlers option to rpki.async.sync_wrapper and rpki.irdb.Zookeeper() to avoid problems when running in environments like mod_wsgi which have strong opinions about what code is and is not allowed to handle signals. This may result in some noise in log files, but there's not much we can do about that if we're not allowed to clean up when terminated, so be it. See #681. svn path=/trunk/; revision=6027 --- rpki/async.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'rpki/async.py') diff --git a/rpki/async.py b/rpki/async.py index b17c31ed..75b4b656 100644 --- a/rpki/async.py +++ b/rpki/async.py @@ -339,8 +339,9 @@ class sync_wrapper(object): err = None fin = False - def __init__(self, func): + def __init__(self, func, disable_signal_handlers = False): self.func = func + self.disable_signal_handlers = disable_signal_handlers def cb(self, res = None): """ @@ -374,7 +375,10 @@ class sync_wrapper(object): self.eb(e) event_defer(thunk) - event_loop() + if self.disable_signal_handlers: + event_loop(catch_signals = ()) + else: + event_loop() if not self.fin: logger.warning("%r event_loop terminated without callback or errback", self) if self.err is None: -- cgit v1.2.3