Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-102251: add missing cleanups fortest_import#104796

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
sunmy2019 wants to merge12 commits intopython:mainfromsunmy2019:gh-102251

Conversation

sunmy2019
Copy link
Member

@sunmy2019sunmy2019 commentedMay 23, 2023
edited by bedevere-bot
Loading

Leak reasons are described here.

#103879 (comment)

For 1, the fix is straightforward.

For 2, I added 2 clean-up functions and trigger them manually.

For 3, I haven't figured out a clean solution, but I would prefer to skip it under ref leak modes only. So I introduce a new method because AFAIK there isn't a way to skip only ref leak tests.

@Eclips4
Copy link
Member

As I understand, this doesn't solve problem, just "shuts up" the noise from known refleaks ontest_import, right?

@sunmy2019
Copy link
MemberAuthor

As I understand, this doesn't solve problem, just "shuts up" the noise from known refleaks ontest_import, right?

That is not true. I do think I did resolve all ref leaks on Linux.

But I did not test it on Windows.

@Eclips4
Copy link
Member

As I understand, this doesn't solve problem, just "shuts up" the noise from known refleaks ontest_import, right?

That is not true. I do think I did resolve all ref leaks on Linux.

But I did not test it on Windows.

Oh, seems on Windows problem doesn't solved. I rebuilt intepreter with your changes and got it:

 ./python-mtest-R3:3test_importRunningDebug|x64interpreter...0:00:00Runtestssequentially0:00:00 [1/1]test_importbeginning6repetitions123456......test_importleaked [41,43,40]references,sum=124test_importleaked [41,41,40]memoryblocks,sum=122test_importfailed (referenceleak)==Testsresult:FAILURE==1testfailed:test_importTotalduration:28.7secTestsresult:FAILURE

Comment on lines -1983 to -1994
if '-R' in sys.argv or '--huntrleaks' in sys.argv:
# https://github.com/python/cpython/issues/102251
raise unittest.SkipTest('unresolved refleaks (see gh-102251)')
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This trick cannot be used with./python -m test -j n, thus causing failures on CI.

@sunmy2019
Copy link
MemberAuthor

sunmy2019 commentedMay 23, 2023
edited
Loading

All ref leaks on Linux come fromSinglephaseInitTests, but running

 .\python_d.exe -m test test_import -R 3:3 -v -i *SinglephaseInitTests*

on Windows does give ref leaks

OK (skipped=5).test_import leaked [41, 43, 40] references, sum=124test_import leaked [41, 41, 40] memory blocks, sum=122

@sunmy2019
Copy link
MemberAuthor

@Eclips4 Can you bisect which test leaks ref?

@Eclips4
Copy link
Member

@Eclips4 Can you bisect which test leaks ref?

Sure!
If we deleteImportTests/test_concurrency refleak tests are passed. Seems that problem in this test

@Eclips4
Copy link
Member

Eclips4 commentedMay 23, 2023
edited
Loading

Also, I tried to found commit which introduce this reference leak ( intest_concurrency)
and again bisected to#94504..

@Eclips4
Copy link
Member

Eclips4 commentedMay 26, 2023
edited
Loading

Oh, seems your solution also works on Windows. ( I forgot to add-j 1 parameter 🤦‍♂️ , sorry)
But problem withtest_concurrency still there, and that's interesting, because it doesn't reproducible on Linux.

Probably, it should be a another PR (at the current moment I still haven't found a solution).
My some notes about it:
If we delete these lines fromtest_concurrency:

sys.modules.pop('package',None)sys.modules.pop('package.submodule',None)

Refleak tests will pass.
Also, this problem confirms that Windows runner in buildbots fleet really needed.

@brettcannonbrettcannon removed their request for reviewMay 29, 2023 17:06
Copy link
Contributor

@erlend-aaslanderlend-aasland left a comment

Choose a reason for hiding this comment

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

Thelibregrtest modification seems way too hacky for my taste. What happens if you apply my suggestion for_testsinglephase.c, and revertall other changes introduced in this PR?

zware reacted with thumbs up emoji
@sunmy2019
Copy link
MemberAuthor

sunmy2019 commentedMay 30, 2023
edited
Loading

revertall other changes introduced in this PR?

There are 3 leak points when running in Linux. Applying your suggestions only fixes one of them.

@erlend-aasland
Copy link
Contributor

revertall other changes introduced in this PR?

There are 3 leak points when running in Linux. Applying your suggestions only fixes one of them.

I suggest you turn this PR1 into a fix for this one issue, so we can land that fix. The fix is obvious; I can land that for you today. The rest of the changes are controversial; I think it would be wise to separate them out.

Also: please don't tag people with in commit messages. Those commits ends up as noise in the GitHub notifications page.

Footnotes

  1. or create a new PR for this

zware reacted with thumbs up emoji

@sunmy2019
Copy link
MemberAuthor

sunmy2019 commentedMay 30, 2023
edited
Loading

  1. or create a new PR for this

I will create a new one.


#105082

erlend-aasland reacted with thumbs up emoji

@erlend-aasland
Copy link
Contributor

erlend-aasland commentedMay 30, 2023
edited
Loading

Status for buildbot run for commit20307d0:

  • buildbot/AMD64 Fedora Stable Refleaks PR:test_peg_generator leaked
  • buildbot/AMD64 RHEL7 Refleaks PR:test_peg_generator leaked
  • buildbot/AMD64 RHEL8 Refleaks PR:test_peg_generator leaked
  • buildbot/PPC64LE RHEL8 Refleaks PR:test_peg_generator leaked
  • buildbot/aarch64 RHEL8 Refleaks PR:test_peg_generator leaked
  • buildbot/s390x Fedora Refleaks PR:test_peg_generator leaked
  • buildbot/s390x RHEL7 Refleaks PR:test_peg_generator leaked
  • buildbot/s390x RHEL8 Refleaks PR:test_peg_generator leaked

@sunmy2019

This comment was marked as outdated.

Copy link
Member

@ericsnowcurrentlyericsnowcurrently left a comment

Choose a reason for hiding this comment

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

LGTM

@ericsnowcurrently
Copy link
Member

GitHub took me straight to "Files changed", so I didn't see the other comments before I gave an approving review. The change looks fine to me, but please be sure to address any other comments before this is merged.

@sunmy2019
Copy link
MemberAuthor

The second part is split to#105085

I will make this PR focus on the 3rd
part of the problem.

@sunmy2019
Copy link
MemberAuthor

Now this PR only has changes related to the 3rd part.


test_basic_multiple_interpreters_deleted_no_reset deliberately leaks things. And we have a "no-leak" version test right after this:test_basic_multiple_interpreters_reset_each.

I think the correct thing to do here is to skip this specific test when hunting ref leaks.


However, the previous approach does not work under-j. And the test main has no way to pass the information to the actual test. So I came up with the name trick.

I am open to any other methods.

@sunmy2019sunmy2019 removed the request for review fromencukouJune 23, 2023 04:27
@sunmy2019sunmy2019 added the 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section labelJun 23, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@sunmy2019 for commit5934e50 🤖

If you want to schedule another build, you need to add the🔨 test-with-refleak-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section labelJun 23, 2023
@sunmy2019sunmy2019 added the 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section labelJun 23, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@sunmy2019 for commit60b4921 🤖

If you want to schedule another build, you need to add the🔨 test-with-refleak-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section labelJun 23, 2023
@erlend-aasland
Copy link
Contributor

Closing in favour ofgh-106013. Thanks for the effort you've put into this@sunmy2019; highly appreciated!

Also, thanks for keeping up with me; sorry for pushing you in different directions, but my opinions changed.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@erlend-aaslanderlend-aaslanderlend-aasland left review comments

@ericsnowcurrentlyericsnowcurrentlyericsnowcurrently approved these changes

@ncoghlanncoghlanAwaiting requested review from ncoghlanncoghlan is a code owner

@warsawwarsawAwaiting requested review from warsawwarsaw is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@sunmy2019@Eclips4@erlend-aasland@bedevere-bot@ericsnowcurrently

[8]ページ先頭

©2009-2025 Movatter.jp