diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-12-30 21:02:43 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-12-30 21:02:43 +0000 |
commit | 74908c803545f9da870aaa4d904fc83808d3189a (patch) | |
tree | 48d481f7826beb2889a8b02c72c22f5558775268 | |
parent | cc3ca52718e0f15a2d0a3f3360977e3b33041db9 (diff) | |
download | portage-74908c803545f9da870aaa4d904fc83808d3189a.tar.gz portage-74908c803545f9da870aaa4d904fc83808d3189a.tar.bz2 portage-74908c803545f9da870aaa4d904fc83808d3189a.zip |
For bug #141361, use an alarm signal to implement a 1 minute timeout for processing inside an elog module.
svn path=/main/trunk/; revision=5430
-rw-r--r-- | pym/portage.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py index 06dcd2f83..2942bb257 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -505,7 +505,16 @@ def elog_process(cpv, mysettings): # TODO: implement a common portage module loader logmodule = __import__("elog_modules.mod_"+s) m = getattr(logmodule, "mod_"+s) + def timeout_handler(signum, frame): + raise portage_exception.PortageException( + "Timeout in elog_process for system '%s'" % s) + import signal + signal.signal(signal.SIGALRM, timeout_handler) + # Timeout after one minute (in case something like the mail + # module gets hung). + signal.alarm(60) m.process(mysettings, cpv, mylogentries, fulllog) + signal.alarm(0) if hasattr(m, "finalize") and not m.finalize in _elog_atexit_handlers: _elog_atexit_handlers.append(m.finalize) atexit_register(m.finalize, mysettings) |