Skip to content

Conversation

ambv
Copy link
Contributor

@ambv ambv commented Nov 4, 2021

The closure in cb_test was the root cause of the refleak, to address it we're taking the callback handle and deleting it when we don't need it anymore. Additionally, other tests explicitly destroy OptionMenu objects to avoid issues with reference cycles.

Before the change

0:00:00 load avg: 4.23 Run tests sequentially
0:00:00 load avg: 4.23 [1/1] test_ttk_guionly
beginning 9 repetitions
123456789
.........
test_ttk_guionly leaked [63, 63, 63, 63] references, sum=252
test_ttk_guionly leaked [31, 31, 31, 31] memory blocks, sum=124
test_ttk_guionly failed (reference leak)

== Tests result: FAILURE ==

After the change

0:00:00 load avg: 10.33 Run tests sequentially
0:00:00 load avg: 10.33 [1/1] test_ttk_guionly
beginning 9 repetitions
123456789
.........

== Tests result: SUCCESS ==

https://bugs.python.org/issue45160

@ambv
Copy link
Contributor Author

ambv commented Nov 5, 2021

Fix confirmed on the Windows 8.1 refleak buildbot:

0:36:09 load avg: 5.80 [146/425] test_imghdr passed -- running: test_io (5 min 9 sec), test_pickle (4 min 17 sec), test_nntplib (1 min)
beginning 6 repetitions
123456
......
0:36:28 load avg: 5.15 [147/425] test_ttk_guionly passed -- running: test_io (5 min 28 sec), test_pickle (4 min 36 sec), test_nntplib (1 min 19 sec)
beginning 6 repetitions
123456
......

Build link: https://buildbot.python.org/all/#/builders/443/builds/9

@ned-deily ned-deily assigned ambv and unassigned ned-deily Nov 5, 2021
@ambv ambv merged commit 54d1e3f into python:main Nov 5, 2021
@miss-islington
Copy link
Contributor

Thanks @ambv for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @ambv, I had trouble checking out the 3.10 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 54d1e3f72ed1ad8e860888c30ee7a285b931c0d1 3.10

@ambv ambv deleted the fix-refleak-ttk branch November 5, 2021 08:51
@bedevere-bot
Copy link

GH-29420 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Nov 5, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 5, 2021
… (pythonGH-29416)

(cherry picked from commit 54d1e3f)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
@ambv ambv added needs backport to 3.10 only security fixes and removed needs backport to 3.10 only security fixes labels Nov 5, 2021
@miss-islington
Copy link
Contributor

Thanks @ambv for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@ambv ambv added needs backport to 3.10 only security fixes and removed needs backport to 3.10 only security fixes labels Nov 5, 2021
@miss-islington
Copy link
Contributor

Thanks @ambv for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 5, 2021
… (pythonGH-29416)

(cherry picked from commit 54d1e3f)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
ambv added a commit that referenced this pull request Nov 5, 2021
…-29416) (GH-29420)

(cherry picked from commit 54d1e3f)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
ambv added a commit that referenced this pull request Nov 5, 2021
…-29416) (GH-29421)

(cherry picked from commit 54d1e3f)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
@terryjreedy terryjreedy removed the needs backport to 3.10 only security fixes label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants