python / python/cpython

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

Open
#141,592 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tests topic-profiling type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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

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_perf_profiler.py, focusing on its setUp and tearDown handling of perf-*.map files in /tmp. Run the test with parallel execution if available and inspect how files are created and cleaned up. Done means each test removes only the map files it created, without deleting files belonging to concurrent tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.