summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/AbstractPollTask.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-03-09 21:46:17 -0800
committerZac Medico <zmedico@gentoo.org>2011-03-09 21:55:11 -0800
commitc649695a92379892a1d545edd12c2bb3dc8c7e41 (patch)
tree0f896329bd36522f77081c1eceeaba0e7b423018 /pym/_emerge/AbstractPollTask.py
parent6b604d43c68cab45ea5668042a53c23d4012bb18 (diff)
downloadportage-c649695a92379892a1d545edd12c2bb3dc8c7e41.tar.gz
portage-c649695a92379892a1d545edd12c2bb3dc8c7e41.tar.bz2
portage-c649695a92379892a1d545edd12c2bb3dc8c7e41.zip
AbstractPollTask: log exceptional events
Previously, when AbstractPollTask receives a POLLERR or POLLNVAL event, it would silently cancel the task. Now it will generate a message like this: !!! SpawnProcess received strange poll event: 8 The message is displayed via a new _log_poll_exception method, which is overridden by AbstractEbuildProcess to log the message via elog. This might help diagnose reported cases of SIGTERM signals killing ebuild processes for no apparent reason: http://code.google.com/p/chromium-os/issues/detail?id=12968
Diffstat (limited to 'pym/_emerge/AbstractPollTask.py')
-rw-r--r--pym/_emerge/AbstractPollTask.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pym/_emerge/AbstractPollTask.py b/pym/_emerge/AbstractPollTask.py
index 833ee3b4c..6cbf984b9 100644
--- a/pym/_emerge/AbstractPollTask.py
+++ b/pym/_emerge/AbstractPollTask.py
@@ -1,8 +1,10 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import array
+import logging
+from portage.util import writemsg_level
from _emerge.AsynchronousTask import AsynchronousTask
from _emerge.PollConstants import PollConstants
class AbstractPollTask(AsynchronousTask):
@@ -39,9 +41,16 @@ class AbstractPollTask(AsynchronousTask):
def _unregister(self):
raise NotImplementedError(self)
+ def _log_poll_exception(self, event):
+ writemsg_level(
+ "!!! %s received strange poll event: %s\n" % \
+ (self.__class__.__name__, event,),
+ level=logging.ERROR, noiselevel=-1)
+
def _unregister_if_appropriate(self, event):
if self._registered:
if event & self._exceptional_events:
+ self._log_poll_exception(event)
self._unregister()
self.cancel()
elif event & PollConstants.POLLHUP: