-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
gh-102251: add missing cleanups for test_import
#104796
Conversation
As I understand, this doesn't solve problem, just "shuts up" the noise from known refleaks on |
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 -m test -R 3:3 test_import
Running Debug|x64 interpreter...
0:00:00 Run tests sequentially
0:00:00 [1/1] test_import
beginning 6 repetitions
123456
......
test_import leaked [41, 43, 40] references, sum=124
test_import leaked [41, 41, 40] memory blocks, sum=122
test_import failed (reference leak)
== Tests result: FAILURE ==
1 test failed:
test_import
Total duration: 28.7 sec
Tests result: 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.
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.
All ref leaks on Linux come from
on Windows does give ref leaks
|
@Eclips4 Can you bisect which test leaks ref? |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
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
|
Status for buildbot run for commit 20307d0:
|
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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. |
The second part is split to #105085 I will make this PR focus on the 3rd |
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. |
🤖 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. |
🤖 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. |
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.