Uh oh!
There was an error while loading. Please reload this page.
gh-102251: add missing cleanups for test_import - #104796
Conversation
Eclips4
commented
May 23, 2023
As I understand, this doesn't solve problem, just "shuts up" the noise from known refleaks on |
sunmy2019
commented
May 23, 2023
That is not true. I do think I did resolve all ref leaks on Linux. But I did not test it on Windows. |
Eclips4
commented
May 23, 2023
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 |
| 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)') |
There was a problem hiding this comment.
This trick cannot be used with ./python -m test -j n, thus causing failures on CI.
All ref leaks on Linux come from on Windows does give ref leaks |
sunmy2019
commented
May 23, 2023
@Eclips4 Can you bisect which test leaks ref? |
Eclips4
commented
May 23, 2023
Sure! |
Also, I tried to found commit which introduce this reference leak ( in |
Oh, seems your solution also works on Windows. ( I forgot to add Probably, it should be a another PR (at the current moment I still haven't found a solution). sys.modules.pop('package', None)
sys.modules.pop('package.submodule', None)Refleak tests will pass. |
erlend-aasland
left a comment
There was a problem hiding this comment.
The libregrtest modification seems way too hacky for my taste. What happens if you apply my suggestion for _testsinglephase.c, and revert all other changes introduced in this PR?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There are 3 leak points when running in Linux. Applying your suggestions only fixes one of them. |
erlend-aasland
commented
May 30, 2023
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
|
Status for buildbot run for commit 20307d0:
|
This comment was marked as outdated.
This comment was marked as outdated.
ericsnowcurrently
commented
May 31, 2023
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
commented
May 31, 2023
The second part is split to #105085 I will make this PR focus on the 3rd |
sunmy2019
commented
Jun 1, 2023
Now this PR only has changes related to the 3rd part.
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 I am open to any other methods. |
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot
commented
Jun 23, 2023
🤖 New build scheduled with the buildbot fleet by @sunmy2019 for commit 5934e50 🤖 If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot
commented
Jun 23, 2023
🤖 New build scheduled with the buildbot fleet by @sunmy2019 for commit 60b4921 🤖 If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
erlend-aasland
commented
Jun 23, 2023
Closing in favour of gh-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. |
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.