Skip to content

bpo-18174: regrtest -R 3:3 checks for handle leak #7827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

bpo-18174: regrtest -R 3:3 checks for handle leak #7827

wants to merge 2 commits into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 20, 2018

  • Add _winapi.GetProcessHandleCount()
  • regrtest now also checks for leak of Windows handles
  • Add an unit test in test_regrtest

Co-Authored-By: Richard Oudkerk [email protected]

https://bugs.python.org/issue18174

* Add _winapi.GetProcessHandleCount()
* regrtest now also checks for leak of Windows handles
* Add an unit test in test_regrtest

Co-Authored-By: Richard Oudkerk <[email protected]>
@vstinner
Copy link
Member Author

I'm running tests with "python -m test -j6 -R 2:3 -r" and it seems like some tests are failing randomly :-/

Example: "test_cmd_line leaked [1, 0, 0] handles, sum=1". Maybe regrtest is too strict.

Detect a leak only if all runs leaked at least 1 handle to avoid
false positives.
@vstinner
Copy link
Member Author

I ran "python -m test -j6 -R 2:3 -r" with the second commit "Make regrtest less strict". 10 tests failed:

  • test__xxsubinterpreters: bug, "unknown interpreter ID"
  • test_asyncio: memory block leak
  • test_builtin: I failed to reproduce this failure
  • test_bz2: leak of 100 handles, maybe the same bug than https://bugs.python.org/issue33916
  • test_compileall: PermissionError
  • test_concurrent_futures: I'm trying to reproduce that one, but I failed to reproduce the leak yet.
  • test_lzma: https://bugs.python.org/issue33916
  • test_multiprocessing_spawn: handle leak
  • test_ntpath: if I recall correctly, it was a bug, not a leak
  • test_script_helper: bug

Tests not always failed because of leaks, but I didn't have time yet to re-run these tests. I will do it later.

@vstinner
Copy link
Member Author

test__xxsubinterpreters: bug, "unknown interpreter ID"

Unrelated to this PR: the test is fragile, see for example https://bugs.python.org/issue33868

test_asyncio: memory block leak

I'm investigating this issue, but there is already one open issue: https://bugs.python.org/issue32710

test_builtin: I failed to reproduce this failure

Unrelated to this PR, and again, I failed to reproduce the issue. Maybe a race condition.

test_bz2: leak of 100 handles, maybe the same bug than https://bugs.python.org/issue33916
test_lzma: https://bugs.python.org/issue33916

Fixed by my PR #7843 (not merged yet)

test_compileall: PermissionError

Unrelated to this PR, and again, I failed to reproduce the issue. Maybe a race condition.

test_concurrent_futures: I'm trying to reproduce that one, but I failed to reproduce the leak yet.

I confirm that I fail to reproduce the leak. Maybe a race condition.

test_multiprocessing_spawn: handle leak

I reproduced the leak. I'm running test.bisect on it.

test_ntpath: if I recall correctly, it was a bug, not a leak

Unrelated to this PR, and again, I failed to reproduce the issue. Maybe a race condition.

test_script_helper: bug

Oh. Running the test alone without -R 3:3 also fails.

@vstinner
Copy link
Member Author

test_asyncio: memory block leak
I'm investigating this issue, but there is already one open issue: https://bugs.python.org/issue32710

Oh, I confirm that it's exactly the same bug: test.test_asyncio.test_events.ProactorEventLoopTests.test_sendfile_close_peer_in_middle_of_receiving leaks memory blocks (not handles!).

@vstinner
Copy link
Member Author

test_multiprocessing_spawn: handle leak
I reproduced the leak. I'm running test.bisect on it.

I found a bug: https://bugs.python.org/issue33929

@vstinner
Copy link
Member Author

test_script_helper: bug
Oh. Running the test alone without -R 3:3 also fails.

Ok, it's also a known issue: https://bugs.python.org/issue32942

@vstinner
Copy link
Member Author

Oh, test_multiprocessing_spawn is still not good, even with my PR 7921:
https://bugs.python.org/issue33966
"test_multiprocessing_spawn.WithProcessesTestPool.test_traceback() leaks 4 handles on Windows"

@vstinner
Copy link
Member Author

Oh, test_multiprocessing_spawn is still not good, even with my PR 7921: https://bugs.python.org/issue33966

I wrote a fix: PR 7966. Using this fix, test_multiprocessing_spawn now doesn't leak handles anymore!

@vstinner
Copy link
Member Author

test_compileall: PermissionError

I created https://bugs.python.org/issue33977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants