Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
GH-90699: fix ref counting of static immortal strings#94850
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
kumaraditya303 commented Jul 14, 2022 • edited by bedevere-bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-bot
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot commented Jul 14, 2022
🤖 New build scheduled with the buildbot fleet by @kumaraditya303 for commit f530250 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
corona10 commented Jul 14, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Thanks for the work, Would you like to provide a reproducible way for detecting leaks? |
kumaraditya303 commented Jul 14, 2022
The following script causes negative ref count: foriinrange(1000): a=repr(False)Output: @kumaraditya303 ➜ /workspaces/cpython (main ✗) $ ./python -X showrefcount main.py [-1001 refs, 0 blocks] |
kumaraditya303 commented Jul 14, 2022
@corona10: The following script causes negative refcount with # main.pyfromioimportTextIOWrappera=TextIOWrapper(open('main.py','rb')) foriina: passa.close()Output: @kumaraditya303 ➜ /workspaces/cpython (main ✗) $ ./python -X showrefcount main.py [-2 refs, 0 blocks] |
corona10 left a comment
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
I reproduced the issue with the attached scripts and issues are solved by @kumaraditya303 's patch :)
Thanks for the work!
corona10 left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
Sorry Kumar, Looks like leaks exist through this patch.
PTAL
With patch
beginning 6 repetitions 123456 ...... test_io leaked [2, 2, 2] references, sum=6 test_io failed (reference leak) in 3 min 23 sec == Tests result: FAILURE == 1 test failed: test_io Total duration: 3 min 23 sec Tests result: FAILURE Without Patch
Raised RLIMIT_NOFILE: 256 -> 1024 0:00:00 load avg: 2.90 Run tests sequentially 0:00:00 load avg: 2.90 [1/1] test_io beginning 6 repetitions 123456 ...... test_io passed in 3 min 23 sec == Tests result: SUCCESS == 1 test OK. Total duration: 3 min 23 sec Tests result: SUCCESS bedevere-bot commented Jul 14, 2022
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
kumaraditya303 commented Jul 14, 2022
Looking, I wonder why only two bots failed if there are refleaks. |
kumaraditya303 commented Jul 14, 2022
Yeah, I am also able to reproduce, bisecting which one is causing leak |
kumaraditya303 commented Jul 14, 2022
I am getting refleak on main branch too, |
kumaraditya303 commented Jul 15, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Refleak was fixed by #94858 |
bedevere-bot commented Jul 18, 2022
🤖 New build scheduled with the buildbot fleet by @kumaraditya303 for commit 0a76abd 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
kumaraditya303 commented Jul 19, 2022
Refleak buildbots are failing on main too, see #94979 |
corona10 left a comment
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
Thank you, Kumar!
miss-islington commented Jul 20, 2022
Thanks @kumaraditya303 for the PR, and @corona10 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
bedevere-bot commented Jul 20, 2022
GH-95037 is a backport of this pull request to the 3.11 branch. |
kumaraditya303 commented Jul 20, 2022
Thanks for the review @corona10! |
Without this they can cause negative refcount in
_Py_RefTotal.