python / python/cpython

`test_threading` failing randomly on CI

Open
#129,266 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tests topic-free-threading
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

See https://github.com/python/cpython/actions/runs/12953185538/job/36134744339?pr=128869

test_reinit_tls_after_fork (test.test_threading.ThreadJoinOnShutdown.test_reinit_tls_after_fork) ... Warning -- Uncaught thread exception: AssertionError
Exception in thread Thread-34 (do_fork_and_wait):
Traceback (most recent call last):
  File "/Users/admin/actions-runner/_work/cpython/cpython/Lib/threading.py", line 1054, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/Users/admin/actions-runner/_work/cpython/cpython/Lib/threading.py", line 996, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/admin/actions-runner/_work/cpython/cpython/Lib/test/test_threading.py", line 1438, in do_fork_and_wait
    support.wait_process(pid, exitcode=50)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/Users/admin/actions-runner/_work/cpython/cpython/Lib/test/support/__init__.py", line 2205, in wait_process
    raise AssertionError(f"process {pid} is still running "
                         f"after {dt:.1f} seconds")
AssertionError: process 10953 is still running after 300.2 seconds
ok

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CI run and Lib/test/test_threading.py, especially ThreadJoinOnShutdown.test_reinit_tls_after_fork and its do_fork_and_wait helper. Trace the call to Lib/test/support/init.py: wait_process and reproduce the 300-second child-process hang. Done means the test no longer fails intermittently or leaves the child running on CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.