EventLoop: qemu-user epoll quirk, bug #451326
authorZac Medico <zmedico@gentoo.org>
Mon, 25 Feb 2013 23:52:44 +0000 (15:52 -0800)
committerZac Medico <zmedico@gentoo.org>
Mon, 25 Feb 2013 23:52:44 +0000 (15:52 -0800)
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

index ad64406c07017f282a668479aa341f54f2892e72..3742055e99136d860ede52e90191439a99c4052e 100644 (file)
@@ -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)