diff --git a/supervisor/supervisord.py b/supervisor/supervisord.py index 0a4f3e697..2265db9c7 100755 --- a/supervisor/supervisord.py +++ b/supervisor/supervisord.py @@ -222,6 +222,14 @@ def runforever(self): raise except: combined_map[fd].handle_error() + else: + # if the fd is not in combined_map, we should unregister it. otherwise, + # it will be polled every time, which may cause 100% cpu usage + self.options.logger.warn('unexpected read event from fd %r' % fd) + try: + self.options.poller.unregister_readable(fd) + except: + pass for fd in w: if fd in combined_map: @@ -237,6 +245,12 @@ def runforever(self): raise except: combined_map[fd].handle_error() + else: + self.options.logger.warn('unexpected write event from fd %r' % fd) + try: + self.options.poller.unregister_writable(fd) + except: + pass for group in pgroups: group.transition()