1 |
commit: 30150206fb0b3e013ef5b163b8d2f24c70a9d977 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 2 04:56:49 2020 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 2 05:01:06 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=30150206 |
7 |
|
8 |
AsyncioEventLoop: always die with SIGTERM in exception handler (bug 705910) |
9 |
|
10 |
Remove call to pdb.set_trace() in exception handler, since it's |
11 |
not very useful, and always die with a SIGTERM for unexpected |
12 |
exceptions here. |
13 |
|
14 |
Bug: https://bugs.gentoo.org/705910 |
15 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
16 |
|
17 |
lib/portage/util/_eventloop/asyncio_event_loop.py | 31 +++++++---------------- |
18 |
1 file changed, 9 insertions(+), 22 deletions(-) |
19 |
|
20 |
diff --git a/lib/portage/util/_eventloop/asyncio_event_loop.py b/lib/portage/util/_eventloop/asyncio_event_loop.py |
21 |
index a11a10205..ce7e06923 100644 |
22 |
--- a/lib/portage/util/_eventloop/asyncio_event_loop.py |
23 |
+++ b/lib/portage/util/_eventloop/asyncio_event_loop.py |
24 |
@@ -1,10 +1,8 @@ |
25 |
-# Copyright 2018 Gentoo Foundation |
26 |
+# Copyright 2018-2020 Gentoo Authors |
27 |
# Distributed under the terms of the GNU General Public License v2 |
28 |
|
29 |
import os |
30 |
-import pdb |
31 |
import signal |
32 |
-import sys |
33 |
|
34 |
try: |
35 |
import asyncio as _real_asyncio |
36 |
@@ -69,25 +67,14 @@ class AsyncioEventLoop(_AbstractEventLoop): |
37 |
""" |
38 |
loop.default_exception_handler(context) |
39 |
if 'exception' in context: |
40 |
- # If we have a tty then start the debugger, since in might |
41 |
- # aid in diagnosis of the problem. If there's no tty, then |
42 |
- # exit immediately. |
43 |
- if all(s.isatty() for s in (sys.stdout, sys.stderr, sys.stdin)): |
44 |
- # Restore default SIGINT handler, since emerge's Scheduler |
45 |
- # has a SIGINT handler which delays exit until after |
46 |
- # cleanup, and cleanup cannot occur here since the event |
47 |
- # loop is suspended (see bug 672540). |
48 |
- signal.signal(signal.SIGINT, signal.SIG_DFL) |
49 |
- pdb.set_trace() |
50 |
- else: |
51 |
- # Normally emerge will wait for all coroutines to complete |
52 |
- # after SIGTERM has been received. However, an unhandled |
53 |
- # exception will prevent the interrupted coroutine from |
54 |
- # completing, therefore use the default SIGTERM handler |
55 |
- # in order to ensure that emerge exits immediately (though |
56 |
- # uncleanly). |
57 |
- signal.signal(signal.SIGTERM, signal.SIG_DFL) |
58 |
- os.kill(os.getpid(), signal.SIGTERM) |
59 |
+ # Normally emerge will wait for all coroutines to complete |
60 |
+ # after SIGTERM has been received. However, an unhandled |
61 |
+ # exception will prevent the interrupted coroutine from |
62 |
+ # completing, therefore use the default SIGTERM handler |
63 |
+ # in order to ensure that emerge exits immediately (though |
64 |
+ # uncleanly). |
65 |
+ signal.signal(signal.SIGTERM, signal.SIG_DFL) |
66 |
+ os.kill(os.getpid(), signal.SIGTERM) |
67 |
|
68 |
def _create_future(self): |
69 |
""" |