aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2020-03-01 20:56:49 -0800
committerZac Medico <zmedico@gentoo.org>2020-03-01 21:01:06 -0800
commit30150206fb0b3e013ef5b163b8d2f24c70a9d977 (patch)
tree1ae25456c860567e51baf99a70268519f669c91d
parent_check_build_log: convert zlib EOFError to eerror message (bug 711174) (diff)
downloadportage-30150206.tar.gz
portage-30150206.tar.bz2
portage-30150206.zip
AsyncioEventLoop: always die with SIGTERM in exception handler (bug 705910)
Remove call to pdb.set_trace() in exception handler, since it's not very useful, and always die with a SIGTERM for unexpected exceptions here. Bug: https://bugs.gentoo.org/705910 Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r--lib/portage/util/_eventloop/asyncio_event_loop.py31
1 files changed, 9 insertions, 22 deletions
diff --git a/lib/portage/util/_eventloop/asyncio_event_loop.py b/lib/portage/util/_eventloop/asyncio_event_loop.py
index a11a10205..ce7e06923 100644
--- a/lib/portage/util/_eventloop/asyncio_event_loop.py
+++ b/lib/portage/util/_eventloop/asyncio_event_loop.py
@@ -1,10 +1,8 @@
-# Copyright 2018 Gentoo Foundation
+# Copyright 2018-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import os
-import pdb
import signal
-import sys
try:
import asyncio as _real_asyncio
@@ -69,25 +67,14 @@ class AsyncioEventLoop(_AbstractEventLoop):
"""
loop.default_exception_handler(context)
if 'exception' in context:
- # If we have a tty then start the debugger, since in might
- # aid in diagnosis of the problem. If there's no tty, then
- # exit immediately.
- if all(s.isatty() for s in (sys.stdout, sys.stderr, sys.stdin)):
- # Restore default SIGINT handler, since emerge's Scheduler
- # has a SIGINT handler which delays exit until after
- # cleanup, and cleanup cannot occur here since the event
- # loop is suspended (see bug 672540).
- signal.signal(signal.SIGINT, signal.SIG_DFL)
- pdb.set_trace()
- else:
- # Normally emerge will wait for all coroutines to complete
- # after SIGTERM has been received. However, an unhandled
- # exception will prevent the interrupted coroutine from
- # completing, therefore use the default SIGTERM handler
- # in order to ensure that emerge exits immediately (though
- # uncleanly).
- signal.signal(signal.SIGTERM, signal.SIG_DFL)
- os.kill(os.getpid(), signal.SIGTERM)
+ # Normally emerge will wait for all coroutines to complete
+ # after SIGTERM has been received. However, an unhandled
+ # exception will prevent the interrupted coroutine from
+ # completing, therefore use the default SIGTERM handler
+ # in order to ensure that emerge exits immediately (though
+ # uncleanly).
+ signal.signal(signal.SIGTERM, signal.SIG_DFL)
+ os.kill(os.getpid(), signal.SIGTERM)
def _create_future(self):
"""