python / python/cpython

`test_free_threading.test_gc.TestGC.test_get_referrers` can segfault

未关闭
#153,777 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

tests topic-free-threading type-crash
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Lib/test/test_free_threading/test_gc.py 开始,重点查看第 50 行的 TestGC.test_get_referrers 和 gc_thread,然后使用 free-threading build 重现该测试,并与链接的 Buildbot 运行结果进行比较。沿着报告中的 _PyType_GetDict 路径追踪 segmentation fault;当该测试在受影响的 build 上不再出现 segmentation fault 时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
backend, testing-qa
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。