Skip to content

bpo-38803: Fix leak in posixmodule #17373

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

Merged
merged 1 commit into from
Nov 26, 2019

Conversation

eduardo-elizondo
Copy link
Contributor

@eduardo-elizondo eduardo-elizondo commented Nov 25, 2019

Fixed a leak in posixmodule by running my leak detection tool:

eelizondo@build -> ./python -m test test_wait3 -R 3:3 -j0
Expected refcnt: 24, actual: 25
class 'resource.struct_rusage'>

This quickly pointed out to the function that pulled out the struct_rusage class.

Run after the fix:

eelizondo@build -> ./python -m test test_wait3 -R 3:3 -j0
0:00:42 load avg: 4.16 [1/1] test_wait3 passed (42.3 sec)
beginning 6 repetitions
123456
123456
......
== Tests result: SUCCESS ==

eelizondo@build -> ./python -m test test_wait4 -R 3:3 -j0
0:00:00 load avg: 3.59 Run tests in parallel using 50 child processes
0:00:30 load avg: 4.02 running: test_wait4 (30.0 sec)
0:00:36 load avg: 4.10 [1/1] test_wait4 passed (36.3 sec)
beginning 6 repetitions
123456
......
== Tests result: SUCCESS ==

https://bugs.python.org/issue38803

@eduardo-elizondo
Copy link
Contributor Author

cc @vstinner

Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eduardo-elizondo cc @vstinner

Thanks for your contribution.
I checked your PR locally and it works well.

master

Python 3.9.0a1+ (heads/master:27fc3b6, Nov 25 2019, 17:29:57

$ ./python -m test test_wait3 -R 3:3 -j0
0:00:00 load avg: 0.00 Run tests in parallel using 10 child processes
0:00:30 load avg: 0.00 running: test_wait3 (30.0 sec)
0:00:36 load avg: 0.00 [1/1/1] test_wait3 failed (36.6 sec)
beginning 6 repetitions
123456
......
test_wait3 leaked [23, 22, 22] references, sum=67

== Tests result: FAILURE ==

1 test failed:
    test_wait3

Total duration: 36.9 sec
Tests result: FAILURE

Proposed

Python 3.9.0a1+ (heads/pr/17373:b67e20e, Nov 25 2019, 17:27:28)

$ ./python -m test test_wait3 -R 3:3 -j0
0:00:00 load avg: 0.00 Run tests in parallel using 10 child processes
0:00:30 load avg: 0.00 running: test_wait3 (30.0 sec)
0:00:36 load avg: 0.00 [1/1] test_wait3 passed (36.6 sec)
beginning 6 repetitions
123456
......

== Tests result: SUCCESS ==

1 test OK.

Total duration: 37.0 sec
Tests result: SUCCESS

@benjaminp benjaminp merged commit e4db1f0 into python:master Nov 26, 2019
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
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.

5 participants