This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_subprocess_send_signal() of test_asyncio hangs if SIGHUP is ignored
Type: Stage: resolved
Components: asyncio, Tests Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cstratak, vstinner, yselivanov
Priority: normal Keywords:

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:49adminsetgithub: 75217
2017-07-26 00:35:00vstinnersetstatus: open -> closed
resolution: fixed
stage: resolved
2017-07-26 00:34:53vstinnersetmessages: + msg299179
2017-07-26 00:33:49vstinnersetmessages: + msg299178
2017-07-26 00:08:44vstinnersetpull_requests: + pull_request2927
2017-07-26 00:08:03vstinnersetmessages: + msg299172
2017-07-25 18:05:15cstrataksetnosy: + cstratak

versions: + Python 3.6
2017-07-25 17:19:13vstinnersetmessages: + msg299120
2017-07-25 15:14:51vstinnersetpull_requests: + pull_request2918
2017-07-25 15:11:10vstinnercreate