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

test_tkinter leaks references on Windows #111531

Closed
vstinner opened this issue Oct 31, 2023 · 6 comments
Closed

test_tkinter leaks references on Windows #111531

vstinner opened this issue Oct 31, 2023 · 6 comments
Assignees

Comments

@vstinner
Copy link
Member

vstinner commented Oct 31, 2023

test_tkinter leaked [336, 336, 337] references, sum=1009
test_tkinter leaked [151, 151, 152] memory blocks, sum=454

Linked PRs

@vstinner vstinner changed the title test_tkinter leaks references test_tkinter leaks references on Windows Oct 31, 2023
@vstinner
Copy link
Member Author

git bisect points me to PR #111202 and commit 9bb202a:

9bb202a1a90ef0edce20c495c9426d9766df11bb is the first bad commit
commit 9bb202a1a90ef0edce20c495c9426d9766df11bb
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Tue Oct 24 13:02:12 2023 +0300

    gh-75666: Tkinter: add tests for binding (GH-111202)

 Lib/test/test_tkinter/test_misc.py | 307 +++++++++++++++++++++++++++++++++++++
 1 file changed, 307 insertions(+)

@terryjreedy
Copy link
Member

@serhiy-storchaka
f:\dev\3x>python -m test -ugui -R3:3 -m BindTest test_tkinter.test_misc
...
test_tkinter.test_misc leaked [336, 336, 336] references, sum=1008
test_tkinter.test_misc leaked [151, 151, 151] memory blocks, sum=453
test_tkinter.test_misc failed (reference leak)

I am running experiments to see which individual tests leak.

@terryjreedy
Copy link
Member

terryjreedy commented Oct 31, 2023

I initially commented out blocks, then changed the -m arg to a test name and checked for only 1 match.
Leaks are pretty well spread out. Results, possibly with errors:
test_??? name(s): references, blocks

bind, unbind, unbind2: 6, 0
rebind, bind_class: 30,16
unbind_class: 30, 8
bind_class_rebind: 46, 18
bind_all: 30, 18
bind_tags: 0, 0
bind_events: 102, 59
unbind_all: 38, 20
bind_all_rebind: 53, 20

@serhiy-storchaka
Copy link
Member

Thank you for your report Victor. It is not only on Windows.

I knew that something may be wrong with bind_class() and bind_all(), and was going to open a new issue when found a reproducer, but I did not know that it also causes leaks.

@serhiy-storchaka
Copy link
Member

Thank you for your tests Terry. Could you please also check if #111533 fixes leaks? I do not see leaks in bind() on Linux, all leaks were in bind_class() and bind_all().

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 31, 2023
…d_all() (pythonGH-111533)

(cherry picked from commit e3353c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 31, 2023
…d_all() (pythonGH-111533)

(cherry picked from commit e3353c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Oct 31, 2023
…nd_all() (GH-111533) (GH-111536)

(cherry picked from commit e3353c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Oct 31, 2023
…nd_all() (GH-111533) (GH-111535)

(cherry picked from commit e3353c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@vstinner
Copy link
Member Author

Oh, that was a quick fix 👍

FullteaR pushed a commit to FullteaR/cpython that referenced this issue Nov 3, 2023
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants