From 071440cc30cc5a625317d5bd47e86c2bfdd8a940 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 25 Feb 2013 15:52:44 -0800 Subject: [PATCH] EventLoop: qemu-user epoll quirk, bug #451326 The epoll implementation in qemu-user-1.2.2 appears to generate events for file descriptors that are no longer registered. Handle it, since it appears to be harmless (see bug #451326). --- pym/portage/util/_eventloop/EventLoop.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py index ad64406c0..3742055e9 100644 --- a/pym/portage/util/_eventloop/EventLoop.py +++ b/pym/portage/util/_eventloop/EventLoop.py @@ -256,7 +256,13 @@ class EventLoop(object): while event_queue: events_handled += 1 f, event = event_queue.pop() - x = event_handlers[f] + try: + x = event_handlers[f] + except KeyError: + # This is known to be triggered by the epoll + # implementation in qemu-user-1.2.2, and appears + # to be harmless (see bug #451326). + continue if not x.callback(f, event, *x.args): self.source_remove(x.source_id) -- 2.26.2