python / python/cpython

test_perf_profiler: race condition when cleaning up perf-*.map files

未关闭
#141,592 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Bug report

Bug description:
What happens

Lib/test/test_perf_profiler.py uses setUp/tearDown to record all perf-*.map files in /tmp at test start, then deletes any new ones at the end.

When tests run in parallel (make -j, CI runners, pytest-xdist), one test deletes map files belonging to another testrace condition.

This causes:

  • Flaky test failures
  • Leftover /tmp/perf-*.map files
  • Unreliable CI results
What should happen

Each test should only delete the perf-*.map file(s) it created, regardless of other concurrent processes.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs
  • gh-141593

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 Lib/test/test_perf_profiler.py 开始,重点关注其 setUp 和 tearDown 对 /tmp 中 perf-*.map 文件的处理。如果支持并行执行,请以并行方式运行测试,并检查文件的创建和清理方式。完成的标准是每个测试只删除它创建的 map 文件,而不会删除属于并发测试的文件。

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

评估

技术栈
python
领域
testing-qa
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

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