Skip to content

test_signal: test_interprocess_signal() failed on GHA macOS #110033

Closed
@vstinner

Description

@vstinner

The problem is that the first subprocess.Popen may not be removed immediately after with self.subprocess_send_signal(pid, "SIGHUP") as child: block, it can survive a little bit. But while it is being deleted automatically, oooops, sigusr1_handler() triggers and raises an SIGUSR1Exception exception which is logged as an "ignored exception", but it is ignored! The test fails.

GHA macOS:

======================================================================
FAIL: test_interprocess_signal (test.test_signal.PosixTests.test_interprocess_signal)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/cpython/cpython/Lib/test/test_signal.py", line 108, in test_interprocess_signal
    assert_python_ok(script)
  File "/Users/runner/work/cpython/cpython/Lib/test/support/script_helper.py", line 166, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/runner/work/cpython/cpython/Lib/test/support/script_helper.py", line 151, in _assert_python
    res.fail(cmd_line)
  File "/Users/runner/work/cpython/cpython/Lib/test/support/script_helper.py", line 76, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/Users/runner/work/cpython/cpython/python.exe', '-X', 'faulthandler', '-I', '/Users/runner/work/cpython/cpython/Lib/test/signalinterproctester.py']

stdout:
---

---

stderr:
---
Exception ignored in: <function Popen.__del__ at 0x109080dd0>
Traceback (most recent call last):
  File "/Users/runner/work/cpython/cpython/Lib/subprocess.py", line 1120, in __del__
    def __del__(self, _maxsize=sys.maxsize, _warn=warnings.warn):

  File "/Users/runner/work/cpython/cpython/Lib/test/signalinterproctester.py", line 23, in sigusr1_handler
    raise SIGUSR1Exception
SIGUSR1Exception: 
F
======================================================================
FAIL: test_interprocess_signal (__main__.InterProcessSignalTests.test_interprocess_signal)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/cpython/cpython/Lib/test/signalinterproctester.py", line 62, in test_interprocess_signal
    with self.assertRaises(SIGUSR1Exception):
AssertionError: SIGUSR1Exception not raised

----------------------------------------------------------------------
Ran 1 test in 0.252s

FAILED (failures=1)
---

----------------------------------------------------------------------
Ran 46 tests in 132.286s

FAILED (failures=1, skipped=10)

build: https://github.com/python/cpython/actions/runs/6340922718/job/17223429951?pr=110026

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions