Issue 31034: test_subprocess_send_signal() of test_asyncio hangs if SIGHUP is ignored (original) (raw)

Issue31034

Created on 2017-07-25 15:11 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2867 merged vstinner,2017-07-25 15:14
PR 2876 merged vstinner,2017-07-26 00:08
Messages (5)
msg299094 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-07-25 15:11
A colleague reported me that the Python test suite hangs on running test_subprocess_send_signal() of test_asyncio. After analysing the issue, it seems like the test hangs becaues the RPM package builder ignores SIGHUP using something like: def daemonize(): [...] signal.signal(signal.SIGHUP, signal.SIG_IGN) [...] While we should see if Koji (software used to build packages) can be patched to restore the default signal handler for SIGHUP, I would like to enhance test_asyncio to not depend on the current SIGHUP signal handler. I modified Lib/site.py to add "import signal; signal.signal(signal.SIGHUP, signal.SIG_IGN)": on 406 test files, only test_asyncio hangs. Attached PR fixes test_asyncio.
msg299120 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-07-25 17:19
New changeset 830080913c22a9834d310294b9f7653234dc6a59 by Victor Stinner in branch 'master': bpo-31034: Reliable signal handler for test_asyncio (#2867) https://github.com/python/cpython/commit/830080913c22a9834d310294b9f7653234dc6a59
msg299172 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-07-26 00:08
Patch to test manually the fix: diff --git a/Lib/test/test_asyncio/__init__.py b/Lib/test/test_asyncio/__init__.py index 80a9eea..1418952 100644 --- a/Lib/test/test_asyncio/__init__.py +++ b/Lib/test/test_asyncio/__init__.py @@ -1,3 +1,4 @@ +import signal; signal.signal(signal.SIGHUP, signal.SIG_IGN) import os from test.support import load_package_tests, import_module
msg299178 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-07-26 00:33
New changeset efe9fcbd2ca85ba9d6af6d95cc530a9c332f37c5 by Victor Stinner in branch '3.6': bpo-31034: Reliable signal handler for test_asyncio (#2867) (#2876) https://github.com/python/cpython/commit/efe9fcbd2ca85ba9d6af6d95cc530a9c332f37c5
msg299179 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-07-26 00:34
Ok, I fixed Python 3.6 and master (future 3.7). Python 3.5 is slowly entering security-only fixes. I don't think that this corner case is improtant enough to justify a backport.
History
Date User Action Args
2022-04-11 14:58:49 admin set github: 75217
2017-07-26 00:35:00 vstinner set status: open -> closedresolution: fixedstage: resolved
2017-07-26 00:34:53 vstinner set messages: +
2017-07-26 00:33:49 vstinner set messages: +
2017-07-26 00:08:44 vstinner set pull_requests: + <pull%5Frequest2927>
2017-07-26 00:08:03 vstinner set messages: +
2017-07-25 18:05:15 cstratak set nosy: + cstratakversions: + Python 3.6
2017-07-25 17:19:13 vstinner set messages: +
2017-07-25 15:14:51 vstinner set pull_requests: + <pull%5Frequest2918>
2017-07-25 15:11:10 vstinner create