python / python/cpython

Thread sanitizer (free-threading) tests fail: test_signal raises RecursionError

Open
#121,065 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug report

 0:02:53 load avg: 5.00 [ 9/22/1] test_signal failed (1 error) (1 min 1 sec) -- running (3): test_logging (2 min 13 sec), test_io (2 min 17 sec), test_queue (1 min 52 sec)
test test_signal failed -- Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython/Lib/test/test_signal.py", line 1384, in test_stress_modifying_handlers
    cycle_handlers()
    ~~~~~~~~~~~~~~^^
  File "/home/runner/work/cpython/cpython/Lib/test/test_signal.py", line 1374, in cycle_handlers
    signal.signal(signum, handler)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/runner/work/cpython/cpython/Lib/signal.py", line 58, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
                             ~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/runner/work/cpython/cpython/Lib/signal.py", line 41, in _enum_to_int
    return int(value)
  File "/home/runner/work/cpython/cpython/Lib/test/test_signal.py", line 1359, in custom_handler
    def custom_handler(signum, frame):
    
  File "/home/runner/work/cpython/cpython/Lib/test/test_signal.py", line 1359, in custom_handler
    def custom_handler(signum, frame):
    
  File "/home/runner/work/cpython/cpython/Lib/test/test_signal.py", line 1359, in custom_handler
    def custom_handler(signum, frame):
    
  [Previous line repeated 237 more times]
RecursionError: maximum recursion depth exceeded

Link: https://github.com/python/cpython/actions/runs/9686054998/job/26727620578

Linked PRs
  • gh-121100

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 Lib/test/test_signal.py, especially test_stress_modifying_handlers, cycle_handlers, and custom_handler, then inspect Lib/signal.py around _enum_to_int. Check the linked gh-121100 work for current context. Done means the test_signal test no longer raises RecursionError in the Thread Sanitizer free-threading run.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.