Skip to content

test_start_new_thread_failed flaky: failed on macOS (free threading) #127421

Description

@colesbury

Bug report

Seen in https://github.com/python/cpython/actions/runs/12082953758/job/33695120037?pr=127399

======================================================================
FAIL: test_start_new_thread_failed (test.test_threading.ThreadTests.test_start_new_thread_failed)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/admin/actions-runner/_work/cpython/cpython/Lib/test/test_threading.py", line 1201, in test_start_new_thread_failed
    _, out, err = assert_python_ok("-u", "-c", code)
                  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/Users/admin/actions-runner/_work/cpython/cpython/Lib/test/support/script_helper.py", line 182, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
  File "/Users/admin/actions-runner/_work/cpython/cpython/Lib/test/support/script_helper.py", line 167, in _assert_python
    res.fail(cmd_line)
    ~~~~~~~~^^^^^^^^^^
  File "/Users/admin/actions-runner/_work/cpython/cpython/Lib/test/support/script_helper.py", line 80, in fail
    raise AssertionError(f"Process return code is {exitcode}\n"
    ...<10 lines>...
                         f"---")
AssertionError: Process return code is -6 (SIGABRT)
command line: ['/Users/admin/actions-runner/_work/cpython/cpython/python.exe', '-X', 'faulthandler', '-I', '-u', '-c', 'if 1:\n            import resource\n            import _thread\n\n            def f():\n                print("shouldn\'t be printed")\n\n            limits = resource.getrlimit(resource.RLIMIT_NPROC)\n            [_, hard] = limits\n            resource.setrlimit(resource.RLIMIT_NPROC, (0, hard))\n\n            try:\n                _thread.start_new_thread(f, ())\n            except RuntimeError:\n                print(\'ok\')\n            else:\n                print(\'!skip!\')\n        ']

Linked PRs

Activity

  1. serhiy-storchaka commented on Nov 29, 2024

    @serhiy-storchaka
    Member

    As a temporary workaround, adding a small sleep in the else branch can help, but there should be better solution. This failure may be a symptom of existing bug.

  2. added 2 commits that reference this issue on Dec 3, 2024
  3. added a commit that references this issue on Dec 3, 2024
  4. added a commit that references this issue on Dec 3, 2024
  5. added a commit that references this issue on Jan 8, 2025
  6. added a commit that references this issue on Jan 12, 2025
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