python / python/cpython

`test_free_threading.test_monitoring` flaky (occasional reference leak)

未關閉
#136,692 8 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

3.13 3.14 3.15 tests topic-free-threading type-bug
主要語言
Python
星號
77.2k
分支
35.9k
PR 合併指標
PR 指標待擷取

描述

Bug report

When running ./python -E -m test --timeout=2700 -R3:3 -u-cpu -j40 test_free_threading.test_monitoring -F, I get a failure every ~50-100 test runs:

0:00:36 load avg: 122.12 [ 55/1] test_free_threading.test_monitoring failed (reference leak)
beginning 6 repetitions. Showing number of leaks (. for 0 or less, X for 10 or more)
123:456
XX. 243
test_free_threading.test_monitoring leaked [2, 4, 3] memory blocks, sum=9

I think the issue is that we rely on Thread.is_alive() instead of joining the threads. I think there are still some objects that may not be freed until the thread is joined (like the handle):

https://github.com/python/cpython/blob/cb59eaefeda5ff44ac0c742bff2b8afc023be313/Lib/test/test_free_threading/test_monitoring.py#L65-L77

Linked PRs
  • gh-136896
  • gh-141832

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 Lib/test/test_free_threading/test_monitoring.py 第 65-77 行附近開始,使用報告中的命令重現洩漏。檢查其中的執行緒清理,然後重新執行重複測試,以確認不再發生參考洩漏;連結的 PR gh-136896 和 gh-141832 表明這項工作已經移到其他地方。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
operating-systems, testing-qa
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。