python / python/cpython

`test_free_threading.test_gc.TestGC.test_get_referrers` can segfault

Open
#153,777 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Crash report

What happened?

See this Buildbot run:

test_get_referrers (test.test_free_threading.test_gc.TestGC.test_get_referrers) ... Fatal Python error: Segmentation fault
<Cannot show all threads while the GIL is disabled>
Stack (most recent call first):
  File "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/Lib/test/test_free_threading/test_gc.py", line 50 in gc_thread
  File "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/Lib/threading.py", line 1160 in run
  File "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/Lib/threading.py", line 1218 in _bootstrap_inner
  File "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/Lib/threading.py", line 1180 in _bootstrap
Current thread's C stack trace (most recent call first):
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at _Py_DumpStack+0x3c [0x2ae5b7875a]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x32b280 [0x2ae5b92280]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x32b9a2 [0x2ae5b929a2]
  Binary file "linux-vdso.so.1", at __vdso_rt_sigreturn+0x0 [0x3fe789c800]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x1b1a0c [0x2ae5a18a0c]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at _PyType_GetDict+0xc [0x2ae5a1a6b4]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x181a9c [0x2ae59e8a9c]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at _Py_LoadAttr_StackRefSteal+0x5a [0x2ae5ac1388]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at _PyEval_EvalFrameDefault+0x100a6 [0x2ae5ad4a5c]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x2780b8 [0x2ae5adf0b8]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x278214 [0x2ae5adf214]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at _PyFunction_Vectorcall+0x48 [0x2ae59847ba]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x11da7c [0x2ae5984a7c]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x11e388 [0x2ae5985388]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x1203b0 [0x2ae59873b0]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x293470 [0x2ae5afa470]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x293914 [0x2ae5afa914]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at _PyCallMethodDescriptorFastWithKeywords_StackRef+0x54 [0x2ae5ac1aee]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at _PyEval_EvalFrameDefault+0x8262 [0x2ae5accc18]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x2780b8 [0x2ae5adf0b8]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x278214 [0x2ae5adf214]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at _PyFunction_Vectorcall+0x48 [0x2ae59847ba]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x11da7c [0x2ae5984a7c]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x11e388 [0x2ae5985388]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x1203b0 [0x2ae59873b0]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x11ed88 [0x2ae5985d88]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x11f0ac [0x2ae59860ac]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at PyObject_Call+0x1e [0x2ae59860de]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x38e73e [0x2ae5bf573e]
  Binary file "/var/lib/buildbot/workers/rise-riscv64-3/3.x.rise-riscv64-3.nogil/build/python", at +0x30e01e [0x2ae5b7501e]
  Binary file "/lib/riscv64-linux-gnu/libc.so.6", at +0x710da [0x3fe77080da]
  Binary file "/lib/riscv64-linux-gnu/libc.so.6", at +0xc38cc [0x3fe775a8cc]
  <truncated rest of calls>
Extension modules: _testcapi, _testinternalcapi (total: 2)
CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Output from running 'python -VV' on the command line:

No response

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_free_threading/test_gc.py, especially TestGC.test_get_referrers and gc_thread at line 50, then reproduce the test using the free-threading build and compare with the linked Buildbot run. Trace the segmentation fault through the reported _PyType_GetDict path; done means the test no longer segfaults on the affected build.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.