python / python/cpython

regrtest: Only report a leak if all test runs leak at least one file descriptor

Open
#157,628 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tests type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Example on a recent buildbot run on AMD64 CentOS9 NoGIL Refleaks 3.x: https://buildbot.python.org/#/builders/1610/builds/4004

test_free_threading leaked [0, 1, 0] references, sum=1 (this is fine)
test_free_threading leaked [0, 1, -1] file descriptors, sum=0

For references, regrtest considers that a test leaks only if all test runs leak at least 1 reference.

For file descriptors, regrtest considers that a test leaks if at least one test run leaks a file descriptor.

In this example, leaked [0, 1, -1] file descriptors, sum=0 says that a test run creates a file descriptor without closing it (first run test, after the warmup): delta +1, but the following test run closes the file descriptor: delta -1. The sum=0 says that there is no leak at the end, all created file descriptors have been closed.

I propose to change the leak detection to only consider that there is a leak if all test runs leak at least one file descriptors.

Linked PRs
  • gh-157629
  • gh-157753

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 by locating regrtest's file-descriptor leak detection and review linked PRs gh-157629 and gh-157753 for work already underway. Use the buildbot example as the reproduction case; done means a leak is reported only when every test run leaks at least one file descriptor.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.