test_perf_profiler: race condition when cleaning up perf-*.map files
Nobody has claimed this yet.
- 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 test → race condition.
This causes:
- Flaky test failures
- Leftover
/tmp/perf-*.mapfiles - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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