Skip to content
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

bpo-32604: Fix reference leak in select module #20600

Merged
merged 1 commit into from
Jun 3, 2020
Merged

bpo-32604: Fix reference leak in select module #20600

merged 1 commit into from
Jun 3, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 2, 2020

Fix reference leak in PyInit_select() of the select module:
remove Py_INCREF(poll_Type).

https://bugs.python.org/issue32604

Fix reference leak in PyInit_select() of the select module:
remove Py_INCREF(poll_Type).
@vstinner
Copy link
Member Author

vstinner commented Jun 2, 2020

@corona10 @shihai1991: Would you mind to review this fix?

Copy link
Contributor

@nanjekyejoannah nanjekyejoannah left a comment

Choose a reason for hiding this comment

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

I tried to see if, with this patch, I could solve the refleaks we have been discussing @vstinner on subinterpreters but I can still see the leaks. Am I missing something? Looks like you said you got a success on your end.

@vstinner
Copy link
Member Author

vstinner commented Jun 3, 2020

I tried to see if, with this patch, I could solve the refleaks we have been discussing @vstinner on subinterpreters but I can still see the leaks. Am I missing something? Looks like you said you got a success on your end.

Which commit did you try? Did you rebase the commit? I used the commit 9d17cbf.

@shihai1991
Copy link
Member

I have run your test in my vm, it have been fixed, thanks.

$ ./python -m test -R 3:3 test_subinterpreters
0:00:00 load avg: 0.76 Run tests sequentially
0:00:00 load avg: 0.76 [1/1] test_subinterpreters
beginning 6 repetitions
123456
......

== Tests result: SUCCESS ==

1 test OK.

Total duration: 465 ms
Tests result: SUCCESS

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.

Well I 've run the test code on my local and I detect the current master branch is leaked
and this PR fixes the issue.

   def test_bpo_32604(self):
        code = f"""import select
a = select.poll()
        """
        ret = test.support.run_in_subinterp(code)
        self.assertEqual(ret, 0)

Thanks for the work @vstinner

@vstinner
Copy link
Member Author

vstinner commented Jun 3, 2020

@nanjekyejoannah:

I tried to see if, with this patch, I could solve the refleaks we have been discussing @vstinner on subinterpreters but I can still see the leaks. Am I missing something? Looks like you said you got a success on your end.

I talked to Joannah in private and she just used the wrong command to test the fix :-)

@corona10:

Well I 've run the test code on my local and I detect the current master branch is leaked
and this PR fixes the issue.

Thanks for this nice manual test!

@vstinner vstinner merged commit 18a9024 into python:master Jun 3, 2020
@vstinner vstinner deleted the fix_select_leak branch June 3, 2020 12:36
@nanjekyejoannah
Copy link
Contributor

Yes, I confirmed with the correct command and this fixes the leak. Thanks @vstinner

arun-mani-j pushed a commit to arun-mani-j/cpython that referenced this pull request Jul 21, 2020
Fix reference leak in PyInit_select() of the select module:
remove Py_INCREF(poll_Type).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants