Skip to content

AssertionError in test.test_multiprocessing_spawn.test_processes.WithProcessesTestProcess.test_interrupt #133651

Closed

Description

@befeleme

Bug report

Bug description:

I try to build Python 3.14.0b1 on Fedora Linux 42, 41, 40, the test has failed so far (the list is incomplete) for debug and freethreading-debug builds, on x86_64, i686, aarch64 arches. Traceback is in all cases similar with the difference of pipe_handle argument value.

Re-running test.test_multiprocessing_spawn.test_processes in verbose mode (matching: test_interrupt)
test_interrupt (test.test_multiprocessing_spawn.test_processes.WithProcessesTestProcess.test_interrupt) ... Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=5, pipe_handle=7)
                                                  ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/multiprocessing/spawn.py", line 122, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/multiprocessing/spawn.py", line 131, in _main
    prepare(preparation_data)
    ~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/multiprocessing/spawn.py", line 244, in prepare
    _fixup_main_from_name(data['init_main_from_name'])
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/multiprocessing/spawn.py", line 268, in _fixup_main_from_name
    main_content = runpy.run_module(mod_name,
                                    run_name="__mp_main__",
                                    alter_sys=True)
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/runpy.py", line 226, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/runpy.py", line 98, in _run_module_code
    _run_code(code, mod_globals, init_globals,
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              mod_name, mod_spec, pkg_name, script_name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/runpy.py", line 88, in _run_code
    exec(code, run_globals)
    ~~~~^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/test/libregrtest/worker.py", line 8, in <module>
    from .setup import setup_process, setup_test_dir
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/test/libregrtest/setup.py", line 12, in <module>
    from .runtests import RunTests
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/test/libregrtest/runtests.py", line 194, in <module>
    @dataclasses.dataclass(slots=True, frozen=True)
     ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/dataclasses.py", line 1362, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
                          frozen, match_args, kw_only, slots,
                          weakref_slot)
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/dataclasses.py", line 1163, in _process_class
    func_builder.add_fns_to_class(cls)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/dataclasses.py", line 507, in add_fns_to_class
    fns = ns['__create_fn__'](**self.locals)
  File "<string>", line 28, in __create_fn__
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/reprlib.py", line 32, in decorating_function
    wrapper.__type_params__ = getattr(user_function, '__type_params__', ())
                              ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
FAIL
======================================================================
FAIL: test_interrupt (test.test_multiprocessing_spawn.test_processes.WithProcessesTestProcess.test_interrupt)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.14.0b1/Lib/test/_test_multiprocessing.py", line 578, in test_interrupt
    self.assertEqual(exitcode, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
AssertionError: -2 != 1

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Activity

  1. befeleme commented on May 8, 2025

    @befeleme
    ContributorAuthor

    Upon repeated builds it looks there's more: test.test_multiprocessing_forkserver.test_processes.WithProcessesTestProcess.test_interrupt_no_handler failed on Fedora 41 on ppcle64.
    Both test_multiprocessing_forkserver and test_multiprocessing_spawn tend to fail on our CI where we test installed debug Python version.

    Re-running test.test_multiprocessing_forkserver.test_processes in verbose mode (matching: test_interrupt_no_handler)
    test_interrupt_no_handler (test.test_multiprocessing_forkserver.test_processes.WithProcessesTestProcess.test_interrupt_no_handler) ... FAIL
    ======================================================================
    FAIL: test_interrupt_no_handler (test.test_multiprocessing_forkserver.test_processes.WithProcessesTestProcess.test_interrupt_no_handler)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/builddir/build/BUILD/python3.14-3.14.0_b1-build/Python-3.14.0b1/Lib/test/_test_multiprocessing.py", line 586, in test_interrupt_no_handler
        self.assertEqual(exitcode, -signal.SIGINT)
        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: 1 != -2
    
  2. vstinner commented on Oct 14, 2026

    @vstinner
    Member

    I saw test_interrupt() failed a few times last days.

    Example on AMD64 Fedora Stable Refleaks 3.x: https://buildbot.python.org/#/builders/320/builds/4698

    test_invalid_typecode (test.test_multiprocessing_fork.test_processes.WithProcessesTestValue.test_invalid_typecode) ... ok
    test_rawvalue (test.test_multiprocessing_fork.test_processes.WithProcessesTestValue.test_rawvalue) ... ok
    test_value (test.test_multiprocessing_fork.test_processes.WithProcessesTestValue.test_value) ... ok
    Warning -- Dangling processes: {<Process name='Process-565' pid=3310113 parent=3306241 started daemon>}
    
    ======================================================================
    ERROR: test_interrupt (test.test_multiprocessing_fork.test_processes.WithProcessesTestProcess.test_interrupt)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/contextlib.py", line 116, in inner
        return func(*args, **kwds)
      File "/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 651, in test_interrupt
        exitcode = self._kill_process(multiprocessing.Process.interrupt)
      File "/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/contextlib.py", line 116, in inner
        return func(*args, **kwds)
      File "/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 632, in _kill_process
        self.assertEqual(join(), None)
                         ~~~~^^
      File "/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 305, in __call__
        return self.func(*args, **kwds)
               ~~~~~~~~~^^^^^^^^^^^^^^^
      File "/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line 156, in join
        res = self._popen.wait(timeout)
      File "/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
        return self.poll(os.WNOHANG if timeout == 0.0 else 0)
               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
        pid, sts = os.waitpid(self.pid, flag)
                   ~~~~~~~~~~^^^^^^^^^^^^^^^^
      File "/home/buildbot-worker/cstratak-fedora-stable-x86_64/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 628, in handler
        raise RuntimeError('join took too long: %s' % p)
    RuntimeError: join took too long: <Process name='Process-565' pid=3310113 parent=3306241 started daemon>
    
    ----------------------------------------------------------------------
    Ran 180 tests in 38.521s
    
    FAILED (errors=1, skipped=13)
    test test.test_multiprocessing_fork.test_processes failed
    
  3. vstinner commented on Oct 22, 2026

    @vstinner
    Member

    Another failure on s390x RHEL9 Refleaks 3.x: https://buildbot.python.org/#/builders/1589/builds/4081

    ERROR: test_interrupt (test.test_multiprocessing_fork.test_processes.WithProcessesTestProcess.test_interrupt)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      ...
      File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.refleak/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
        return self.poll(os.WNOHANG if timeout == 0.0 else 0)
               ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.refleak/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
        pid, sts = os.waitpid(self.pid, flag)
                   ~~~~~~~~~~^^^^^^^^^^^^^^^^
      File "/var/lib/buildbot/worker/cstratak-rhel9-s390x/3.x.cstratak-rhel9-s390x.refleak/build/Lib/test/_test_multiprocessing.py", line 628, in handler
        raise RuntimeError('join took too long: %s' % p)
    RuntimeError: join took too long: <Process name='Process-1371' pid=214136 parent=190670 started daemon>
    
  4. added a commit that references this issue on Oct 22, 2026
  5. vstinner commented on Oct 22, 2026

    @vstinner
    Member

    test_interrupt() uses an hardcoded timeout of 10 seconds. I wrote #160281 to reuse support.SHORT_TIMEOUT which is 30 seconds by default, but SHORT_TIMEOUT is increased if TIMEOUT of python -m test --timeout=TIMEOUT is longer than 20 minutes. So if you're still impacted after my change is merged, use --timeout with a timeout of at least 30 minutes.

  6. vstinner commented on Oct 22, 2026

    @vstinner
    Member

    test_interrupt_no_handler():

    self.assertEqual(exitcode, -signal.SIGINT)
    AssertionError: 1 != -2

    For this test failure, I have no clue. Maybe increasing the timeout will kill test_interrupt_no_handler() too, since it uses the same code.

  7. added a commit that references this issue on Oct 22, 2026
  8. vstinner commented on Oct 22, 2026

    @vstinner
    Member

    Ok, I increased the timeout in the main branch. Backports to 3.14 and 3.15 will follow (once CI pass on my PRs). I close the issue. Reopen the issue or open a new issue if you hit this issue again.

    If you hit this issue again, please explain in your bug report how you run the test suite, the number of CPUs, and if your system is idle or busy.

  9. vstinner commented on Oct 22, 2026

    @vstinner
    Member

    @befeleme: Sorry, this took longer than expected to fix this test failure :-)

  10. added 2 commits that reference this issue on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions