python / python/cpython

Incremental GC does not collect garbage as soon as expected

未關閉
#142,002 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

3.14 3.15 interpreter-core performance type-bug
主要語言
Python
星號
77.2k
分支
35.9k
PR 合併指標
PR 指標待擷取

描述

Bug report

Bug description:

This was found by @Yhg1s . If you run tests with this command:

./python -m test --randseed=3169227856 --no-randomize --single-process test_pyclbr test_trace test_pdb test_iter test_ordered_dict test_urllib2_localnet test_array test_generated_cases test_typing test_fnmatch test_tools test_descr test___all__ test_xml_dom_xmlbuilder test_nturl2path test_hmac test_pickle test_android test_ipaddress test_modulefinder test_interpreters test_zoneinfo test_runpy test_sqlite3 test_bdb test_zipfile test_crossinterp test_pulldom test_pkgutil test_re test_dbm_sqlite3 test_venv test_pyrepl test_xml_etree_c test_gc

The test_gc unit test fails with:

  File "/home/thomas/python/python/main/Lib/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/home/thomas/python/python/main/Lib/test/test_gc.py", line 1573, in test_bug1055820d
    self.fail("gc didn't happen after 50000 iterations")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: gc didn't happen after 50000 iterations

Reverting GH-140262 seems to fix this. It is possible this is related to GH-141890 as well.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs
  • gh-142001

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

從 test/test_gc.py 開始,尤其是 test_bug1055820d,並使用報告中的命令重現失敗。將行為與還原 GH-140262 後的行為進行比較,並調查其與 GH-141890 可能存在的關係。當測試不再回報垃圾回收在 50,000 次迭代後失敗時,即表示完成。

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

評估

技術堆疊
python
領域
backend
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
25/100

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

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